The geoid ( /ˈdʒiː.ɔɪd/) is the shape that the ocean surface would take under the influence of the gravity of Earth, including gravitational attraction and Earth's rotation, if other influences such as winds and tides were absent. This surface is extended through the continents (such as with very narrow hypothetical canals). According to Gauss, who first described it, it is the "mathematical figure of the Earth", a smooth but irregular surface whose shape results from the uneven distribution of mass within and on the surface of Earth.  It can be known only through extensive gravitational measurements and calculations. Despite being an important concept for almost 200 years in the history of geodesy and geophysics, it has been defined to high precision only since advances in satellite geodesy in the late 20th century.
All points on a geoid surface have the same geopotential (the sum of gravitational potential energy and centrifugal potential energy). The force of gravity acts everywhere perpendicular to the geoid, meaning that plumb lines point perpendicular and water levels parallel to the geoid if only gravity and rotational acceleration were at work. Earth's gravity acceleration is non-uniform over the geoid, which is only an equipotential surface, a sufficient condition for a ball to remain at rest instead of rolling over the geoid.  The geoid undulation or geoidal height is the height of the geoid relative to a given reference ellipsoid. The geoid serves as a coordinate surface for various vertical coordinates, such as orthometric heights, geopotential heights, and dynamic heights (see Geodesy#Heights).
The geoid surface is irregular, unlike the reference ellipsoid (which is a mathematical idealized representation of the physical Earth as an ellipsoid), but is considerably smoother than Earth's physical surface. Although the "ground" of the Earth has excursions on the order of +8,800 m ( Mount Everest) and −11,000 m ( Marianas Trench), the geoid's deviation from an ellipsoid ranges from +85 m (Iceland) to −106 m (southern India), less than 200 m total. 
If the ocean were isopycnic (of constant density) and undisturbed by tides, currents or weather, its surface would resemble the geoid. The permanent deviation between the geoid and mean sea level is called ocean surface topography. If the continental land masses were crisscrossed by a series of tunnels or canals, the sea level in those canals would also very nearly coincide with the geoid. In reality, the geoid does not have a physical meaning under the continents, but geodesists are able to derive the heights of continental points above this imaginary, yet physically defined, surface by spirit leveling.
Being an equipotential surface, the geoid is, by definition, a surface to which the force of gravity is everywhere perpendicular. That means that when traveling by ship, one does not notice the undulations of the geoid; the local vertical (plumb line) is always perpendicular to the geoid and the local horizon tangential to it. Likewise, spirit levels will always be parallel to the geoid.
The gravitational field of the earth is not uniform. An oblate spheroid is typically used as the idealized earth, but even if the earth were spherical and did not rotate, the strength of gravity would not be the same everywhere because density varies throughout the planet. This is due to magma distributions, the density and weight of different geological compositions in the earth's crust, mountain ranges, deep sea trenches, crust compaction due to glaciers, and so on.
If that sphere were then covered in water, the water would not be the same height everywhere. Instead, the water level would be higher or lower with respect to Earth's center, depending on the integral of the strength of gravity from the center of the earth to that location. The geoid level coincides with where the water would be. Generally the geoid rises where the earth material is locally more dense, which is where the earth exerts greater gravitational pull.
The geoid undulation, geoid height, or geoid anomaly is the height of the geoid relative to a given ellipsoid of reference. The undulation is not standardized, as different countries use different mean sea levels as reference, but most commonly refers to the EGM96 geoid.
In maps and common use the height over the mean sea level (such as orthometric height) is used to indicate the height of elevations while the ellipsoidal height results from the GPS system and similar GNSS.
The deviation between the ellipsoidal height and the orthometric height can be calculated by
(An analogous relationship exists between normal heights and the quasigeoid.)
So a GPS receiver on a ship may, during the course of a long voyage, indicate height variations, even though the ship will always be at sea level (neglecting the effects of tides). That is because GPS satellites, orbiting about the center of gravity of the Earth, can measure heights only relative to a geocentric reference ellipsoid. To obtain one's orthometric height, a raw GPS reading must be corrected. Conversely, height determined by spirit leveling from a tide gauge, as in traditional land surveying, is closer to orthometric height. Modern GPS receivers have a grid implemented in their software by which they obtain, from the current position, the height of the geoid (e.g. the EGM-96 geoid) over the World Geodetic System (WGS) ellipsoid. They are then able to correct the height above the WGS ellipsoid to the height above the EGM96 geoid. When height is not zero on a ship, the discrepancy is due to other factors such as ocean tides, atmospheric pressure (meteorological effects), local sea surface topography and measurement uncertainties.
The surface of the geoid is higher than the reference ellipsoid wherever there is a positive gravity anomaly (mass excess) and lower than the reference ellipsoid wherever there is a negative gravity anomaly (mass deficit). 
This relationship can be understood by recalling that gravity potential is defined so that it has negative values and is inversely proportional to distance from the body. So, while a mass excess will strengthen the gravity acceleration, it will decrease the gravity potential. As a consequence, the geoid's defining equipotential surface will be found displaced away from the mass excess. Analogously, a mass deficit will weaken the gravity pull but will increase the geopotential at a given distance, causing the geoid to move towards the mass deficit. The presence of a localized inclusion in the background medium will rotate the gravity acceleration vectors slightly towards and away a denser or lighter body, respectively, causing a dimple or a bump in the equipotential surface. 
The largest absolute deviation can be found in the " Indian Ocean geoid low". 
Variations in the height of the geoidal surface are related to anomalous density distributions within the Earth. Geoid measures thus help understanding the internal structure of the planet. Synthetic calculations show that the geoidal signature of a thickened crust (for example, in orogenic belts produced by continental collision) is positive, opposite to what should be expected if the thickening affects the entire lithosphere. Mantle convection also changes the shape of the geoid over time. 
Calculating the undulation is mathematically challenging.   This is why many handheld GPS receivers have built-in undulation lookup tables  to determine the height above sea level.
The precise geoid solution by Vaníček and co-workers improved on the Stokesian approach to geoid computation.  Their solution enables millimetre-to-centimetre accuracy in geoid computation, an order-of-magnitude improvement from previous classical solutions.    
Geoid undulations display uncertainties which can be estimated by using several methods, e.g. least-squares collocation (LSC), fuzzy logic, artificial neutral networks, radial basis functions (RBF), and geostatistical techniques. Geostatistical approach has been defined as the most improved technique in prediction of geoid undulation. 
Recent satellite missions, such as the Gravity Field and Steady-State Ocean Circulation Explorer (GOCE) and GRACE, have enabled the study of time-variable geoid signals. The first products based on GOCE satellite data became available online in June 2010, through the European Space Agency (ESA)'s Earth observation user services tools.   ESA launched the satellite in March 2009 on a mission to map Earth's gravity with unprecedented accuracy and spatial resolution. On 31 March 2011, the new geoid model was unveiled at the Fourth International GOCE User Workshop hosted at the Technical University of Munich, Germany.  Studies using the time-variable geoid computed from GRACE data have provided information on global hydrologic cycles,  mass balances of ice sheets,  and postglacial rebound.  From postglacial rebound measurements, time-variable GRACE data can be used to deduce the viscosity of Earth's mantle. 
Spherical harmonics are often used to approximate the shape of the geoid. The current best such set of spherical harmonic coefficients is EGM2020 (Earth Gravity Model 2020), determined in an international collaborative project led by the National Imagery and Mapping Agency (now the National Geospatial-Intelligence Agency, or NGA). The mathematical description of the non-rotating part of the potential function in this model is: 
where and are geocentric (spherical) latitude and longitude respectively, are the fully normalized associated Legendre polynomials of degree and order , and and are the numerical coefficients of the model based on measured data. Note that the above equation describes the Earth's gravitational potential , not the geoid itself, at location the co-ordinate being the geocentric radius, i.e., distance from the Earth's centre. The geoid is a particular equipotential surface,  and is somewhat involved to compute. The gradient of this potential also provides a model of the gravitational acceleration. The most commonly used EGM96 contains a full set of coefficients to degree and order 360 (i.e. ), describing details in the global geoid as small as 55 km (or 110 km, depending on your definition of resolution). The number of coefficients, and , can be determined by first observing in the equation for V that for a specific value of n there are two coefficients for every value of m except for m = 0. There is only one coefficient when m=0 since . There are thus (2n+1) coefficients for every value of n. Using these facts and the formula, , it follows that the total number of coefficients is given by
For many applications the complete series is unnecessarily complex and is truncated after a few (perhaps several dozen) terms.
Still, even high resolution models have been developed. Many of the authors of EGM96 have published EGM2008. It incorporates much of the new satellite gravity data (e.g., the Gravity Recovery and Climate Experiment), and supports up to degree and order 2160 (1/6 of a degree, requiring over 4 million coefficients),  with additional coefficients extending to degree 2190 and order 2159.  EGM2020 is the planned follow-up of 2020 (now overdue), containing the same number of harmonics generated with better data.