Observations and models show that near-surface relative humidity is nearly constant at similar to 80% over the ocean in the current climate, and almost invariant in the global mean in projected future climates. Here, this behavior is investigated through the development of a simple theoretical model for near-surface relative humidity by considering the moisture balance above a uniform ocean surface. The relative humidity is predicted to depend on only the near-surface wind speed, air-surface temperature difference, surface wetness and large-scale moisture convergence. Although developed in the context of moist over-ocean convection, the theory is able to determine the relative humidity in a suite of idealized simulations over both wet and dry surfaces with a root-mean-square error of less than 3%. The theory also predicts the climatology of relative humidity over the ocean with a root-mean-square error of less than 3%. The theory thus provides a theoretical basis for investigating changes in relative humidity over the ocean, water vapor feedbacks and the water cycle in current and future climates. Relative humidity is the water content of air relative to its saturation value. Observations and climate models show that global mean near-surface relative humidity is almost invariant in a changing climate, an observation which underpins the enhancement of the water cycle with increasing global mean temperatures and surface radiative feedbacks. Furthermore, relative humidity over the ocean, whether in the tropics or polar regions, takes a near uniform value of similar to 80%. However, a theoretical basis for this remarkable invariance of relative humidity has not been previously established. Here we show that near-surface relative humidity is controlled by the geometry of moist convection over the ocean surface. Its value is set by a non-dimensional geometric constant and is independent of the absolute air temperature, with weak dependence on near-surface wind speeds, air-surface temperature difference and large-scale moisture convergence. Hence, the over ocean relative humidity is largely climate and latitude invariant. Convection above the ocean surface exhibits a characteristic geometry that controls the value of near-surface relative humidity A quadratic equation is derived to predict near-surface relative humidity in terms of known surface properties and a geometric constant The equation predicts the relative humidity in idealized simulations and ocean observations with less than 3% error