Abstract We present genetIC, a new code for generating initial conditions for cosmological N-body simulations. The code allows precise, user-specified alterations to be made to arbitrary regions of the simulation (while maintaining consistency with the statistical ensemble). These “genetic modifications” allow, for example, the history, mass, or environment of a target halo to be altered in order to study the effect on their evolution. The code natively supports initial conditions with nested zoom regions at progressively increasing resolution. Modifications in the high-resolution region must propagate self-consistently onto the lower-resolution grids; to enable this while maintaining a small memory footprint, we introduce a Fourier-space filtering approach to generating fields at variable resolution. Due to a close correspondence with modifications, constrained initial conditions can also be produced by genetIC (for example, with the aim of matching structures in the local universe). We test the accuracy of modifications performed within zoom initial conditions. The code achieves subpercent precision, which is easily sufficient for current applications in galaxy formation.