Sour gas includes acidic gases such as hydrogen sulfide and carbon dioxide, which lead to a specific smell, toxicity effect, and a reduction in the overall energy of the gas. In addition, the proximity of these acid gases with water causes the production of a very corrosive acid compound, which increases the price of its transportation. Today, membrane technology is widely used in the separation process due to less energy consumption, low weight and volume, ease of access, as well as the high flexibility of the process. In this research, molecular dynamics simulation of CO2/CH4 separation by modified graphene membrane (C3N) was investigated. First, problem different cavities with different geometrical shapes investigated. By increasing the hole size, regardless of the type of the hole, the efficiency of gas passage increases and reaches a constant value for the size of the holes greater than 3.5 Å. Therefore, increasing the hole size by more than 3.5 Å does not affect the efficiency of the gas passage. Meanwhile, for the size of the holes greater than 2.75 Å, the selectivity between gases reaches zero. Therefore, this hole size is an optimal value. Furthermore, a 4.9 Å hole led to high selectivity (infinity) for carbon dioxide flux of 365.65 (mol/m2.s) that means no methane molecules passed through it.