Tropical peatlands now emit hundreds of megatons of carbon dioxide per year because of human disruption of the feedbacks that link peat accumulation and groundwater hydrology. However, no quantitative theory has existed for how patterns of carbon storage and release accompanying growth and subsidence of tropical peatlands are affected by climate and disturbance. Using comprehensive data from a pristine peatland in Brunei Darussalam, we show how rainfall and groundwater flow determine a shape parameter (the Laplacian of the peat surface elevation) that specifies, under a given rainfall regime, the ultimate, stable morphology, and hence carbon storage, of a tropical peatland within a network of rivers or canals. We find that peatlands reach their ultimate shape first at the edges of peat domes where they are bounded by rivers, so that the rate of carbon uptake accompanying their growth is proportional to the area of the still-growing dome interior. We use this model to study how tropical peatland carbon storage and fluxes are controlled by changes in climate, sea level, and drainage networks. We find that fluctuations in net precipitation on timescales from hours to years can reduce long-term peat accumulation. Our mathematical and numerical models can be used to predict long-term effects of changes in temporal rainfall patterns and drainage networks on tropical peatland geomorphology and carbon storage.