Method for calculating a present residual gas mass in a cylinder of an internal combustion engine, wherein the cylinder has at least one inlet valve and one outlet valve, comprising: obtaining a base cylinder residual gas mass value m RG0 for a steady-state operating state of the internal combustion engine in the case of an exhaust-gas temperature T 0, wherein the base cylinder residual gas mass value m RG0 is based on a predefined model; determining a first cylinder residual gas mass value m tot0 which indicates a cylinder residual gas mass that remains in the cylinder dead volume after a discharge of exhaust gas, wherein the first cylinder residual gas mass value m tot0 for the exhaust-gas temperature T 0 determined in the steady-state operating state corresponds to a previously stored value, or is obtained dynamically on the basis of a predefined model; determining a second cylinder residual gas mass value m res0 which indicates a cylinder residual gas mass that flows into the cylinder owing to a valve overlap of the inlet valve and of the outlet valve, wherein the following applies: m RG 0 = m tot 0 + m res 0, wherein the second cylinder residual gas mass value m res0 is determined by subtracting the first cylinder residual gas mass value m tot0 from the base cylinder residual gas mass value m RG0; determining a present exhaust-gas temperature T 1; and calculating the present residual gas mass m RG1 in the cylinder on the basis of a first present cylinder residual gas mass value m tot1 and a second present cylinder residual gas mass value m res1, wherein the following applies: m RG 1 = m tot 1 + m res 1, wherein the first present cylinder residual gas mass value m tot1 is calculated in accordance with m tot 1 = m tot 0 ⋅ T 0 T 1 and the second present cylinder residual gas mass value m res1 is calculated in accordance with m res 1 = m res 0 ⋅ T 0 T 1. obtaining a base cylinder residual gas mass value m RG0 for a steady-state operating state of the internal combustion engine in the case of an exhaust-gas temperature T 0, wherein the base cylinder residual gas mass value m RG0 is based on a predefined model; determining a first cylinder residual gas mass value m tot0 which indicates a cylinder residual gas mass that remains in the cylinder dead volume after a discharge of exhaust gas, wherein the first cylinder residual gas mass value m tot0 for the exhaust-gas temperature T 0 determined in the steady-state operating state corresponds to a previously stored value, or is obtained dynamically on the basis of a predefined model; determining a second cylinder residual gas mass value m res0 which indicates a cylinder residual gas mass that flows into the cylinder owing to a valve overlap of the inlet valve and of the outlet valve, wherein the following applies: m RG 0 = m tot 0 + m res 0, wherein the second cylinder residual gas mass value m res0 is determined by subtracting the first cylinder residual gas mass value m tot0 from the base cylinder residual gas mass value m RG0; determining a present exhaust-gas temperature T 1; and calculating the present residual gas mass m RG1 in the cylinder on the basis of a first present cylinder residual gas mass value m tot1 and a second present cylinder residual gas mass value m res1, wherein the following applies: m RG 1 = m tot 1 + m res 1, wherein the first present cylinder residual gas mass value m tot1 is calculated in accordance with m tot 1 = m tot 0 ⋅ T 0 T 1 and the second present cylinder residual gas mass value m res1 is calculated in accordance with m res 1 = m res 0 ⋅ T 0 T 1. wherein the second cylinder residual gas mass value m res0 is determined by subtracting the first cylinder residual gas mass value m tot0 from the base cylinder residual gas mass value m RG0; determining a present exhaust-gas temperature T 1; and calculating the present residual gas mass m RG1 in the cylinder on the basis of a first present cylinder residual gas mass value m tot1 and a second present cylinder residual gas mass value m res1, wherein the following applies: m RG 1 = m tot 1 + m res 1, wherein the first present cylinder residual gas mass value m tot1 is calculated in accordance with m tot 1 = m tot 0 ⋅ T 0 T 1 and the second present cylinder residual gas mass value m res1 is calculated in accordance with m res 1 = m res 0 ⋅ T 0 T 1.