We construct Villain Hamiltonians for compact scalars and abelian gauge theories. The Villain integers are promoted to integral spectrum operators, whose canonical conjugates are naturally compact scalars. Further, depending on the theory, these conjugate operators can be interpreted as (higher-form) gauge fields. If a gauge symmetry is imposed on these dual gauge fields, a natural constraint on the Villain operator leads to the absence of defects (e.g. vortices, monopoles,…). These lattice models therefore have the same symmetry and anomaly structure as their corresponding continuum models. Moreover they can be formulated in a way that makes the well-know dualities look manifest, e.g. a compact scalar in 2d has a T-duality, in 3d is dual to a U(1) gauge theory, etc. We further discuss the gauged version of compact scalars on the lattice, its anomalies and solution, as well as a particular limit of the gauged XY model at strong coupling which reduces to the transverse-field Ising model. The construction for higher-form gauge theories is similar. We apply these ideas to the constructions of some models which are of interest to fracton physics, in particular the XY-plaquette model and the tensor gauge field model. The XY-plaquette model in 2+1d coupled to a tensor gauge fields at strong gauge coupling is also exactly described by a transverse field quantum J1 − J2 Ising model with J1 = 2J2, and discuss the phase structure of such models.