An efficient and easy to implement method to generate Cartesian grids is presented. The presented method generates various kinds of Cartesian grids such as uniform, octree and embedded boundary grids. It supports the variation of grid size along each spatial direction as well as anisotropic and non-graded refinements. The efficiency and ease of implementation are the main benefits of the presented method in contrast to the alternative methods. Regarding octree grid generation, applying a simple and efficient data compression method permits to store all grid levels without considerable memory overhead. The presented method generates octree grids up to a 13-level refinement ($8192^{3}$ grids on the finest level) from a complicated geometry in a few minutes on the traditional desktop computers. The FORTRAN 90 implementation of the presented method is freely available under the terms of the GNU general public license.