Kinetic theory describes a dilute monatomic gas using a distribution function f(q,p,t), the expected phase-space density of particles at a given position q with a given momentum p. The distribution function evolves according to the collisionless Boltzmann equation in the high Knudsen number limit. Fluid dynamics provides an alternative description of the gas using macroscopic hydrodynamic variables that are functions of position and time only. The mass, momentum and entropy densities of the gas evolve according to the compressible Euler equations in the limit of vanishing viscosity and thermal diffusivity. Both systems can be formulated as noncanonical Hamiltonian systems. Each configuration space is an infinite-dimensional Poisson manifold, and the dynamics is the flow generated by a Hamiltonian functional via a Poisson bracket. We construct a map J1 from the space of distribution functions to the space of hydrodynamic variables that respects the Poisson brackets on the two spaces. This map is therefore a Poisson map. It maps the p-integral of the Boltzmann entropy flogf to the hydrodynamic entropy density. This map belongs to a family of Poisson maps to spaces that include generalised entropy densities as additional hydrodynamic variables. The whole family can be generated from the Taylor expansion of a further Poisson map that depends on a formal parameter. If the kinetic-theory Hamiltonian factors through the Poisson map J1, an exact reduction of kinetic theory to fluid dynamics is possible. However, this is not the case. Nonetheless, by ignoring the contribution to the Hamiltonian from the entropy of the distribution function relative to its local Maxwellian, a distribution function defined by the p-moments ∫dnp(1,p,|p|2)f, we construct an approximate Hamiltonian that factors through the map. The resulting reduced Hamiltonian, which depends on the hydrodynamic variables only, generates the compressible Euler equations. We can thus derive the compressible Euler equations as a Hamiltonian approximation to kinetic theory. We also give an analogous Hamiltonian derivation of the compressible Euler–Poisson equations with non-constant entropy, starting from the Vlasov–Poisson equation.