A planet’s crust bears witness to the history of planetary formation and evolution, but for Mars, no absolute measurement of crustal thickness has been available. Here, we determine the structure of the crust beneath the InSight landing site on Mars using both marsquake recordings and the ambient wavefield. By analyzing seismic phases that are reflected and converted at subsurface interfaces, we find that the observations are consistent with models with at least two and possibly three interfaces. If the second interface is the boundary of the crust, the thickness is 20 ± 5 kilometers, whereas if the third interface is the boundary, the thickness is 39 ± 8 kilometers. Global maps of gravity and topography allow extrapolation of this point measurement to the whole planet, showing that the average thickness of the martian crust lies between 24 and 72 kilometers. Independent bulk composition and geodynamic constraints show that the thicker model is consistent with the abundances of crustal heat-producing elements observed for the shallow surface, whereas the thinner model requires greater concentration at depth.