For a knot diagram we introduce an operation which does not increase the genus of the diagram and does not change its representing knot type. We also describe a condition for this operation to certainly decrease the genus. The proof involves the study of a relation between the genus of a virtual knot diagram and the genus of a knotoid diagram, the former of which has been introduced by Stoimenow, Tchernov and Vdovina, and the latter by Turaev recently. Our operation has a simple interpretation in terms of Gauss codes and hence can easily be computer-implemented.