Inverse design algorithms are the basis for realizing high-performance, freeform nanophotonic devices. Current methods to enforce geometric constraints, such as practical fabrication constraints, are heuristic and not robust. In this work, we show that hard geometric constraints can be imposed on inverse-designed devices by reparameterizing the design space itself. Instead of evaluating and modifying devices in the physical device space, candidate device layouts are defined in a constraint-free latent space and mathematically transformed to the physical device space, which robustly imposes geometric constraints. Modifications to the physical devices, specified by inverse design algorithms, are made to their latent space representations using backpropagation. As a proof-of-concept demonstration, we apply reparameterization to enforce strict minimum feature size constraints in local and global topology optimizers for metagratings. We anticipate that concepts in reparameterization will provide a general and meaningful platform to incorporate physics and physical constraints in any gradient-based optimizer, including machine learning-enabled global optimizers.