Carbon gas balance was evaluated in an anthropogenically impacted (Mtoni) and a pristine (Ras Dege) mangrove forest in Tanzania. Exchange of carbon dioxide (CO2) was measured for inundated and air-exposed sediments during day and night using in situ and laboratory incubations. In situ methane (CH4) emissions were measured in the dark during air exposure only. Emission of CO2 and CH4 from open waters (e.g. creeks) was estimated from diurnal measurements of CO2, partial pressure (pCO2) and CH4 concentrations. CO2 emission from darkened sediments devoid of biogenic structures was comparable during inundation and air exposure (28 to 115 mmol m–2 d–1) with no differences between mangrove forests. Benthic primary production was low with only occasional net uptake of CO2 by the sediments. Emissions of CH4 from air-exposed sediment were generally 3 orders of magnitude lower than for CO2. Presence of pneumatophores and crab burrows increased low tide emissions several fold. Emissions from open waters were dependent on tidal level and wind speed. Lowest emission occurred during high tide (1 to 6 mmol CO2 m–2 d–1; 10 to 80 µmol CH4 m–2 d–1) and highest during low tide (30 to 80 mmol CO2 m–2 d–1; 100 to 350 µmol CH4 m–2 d–1) when supersaturated runoff from the forest floor and porewater seepage reached the creek water. Based on global average primary production and measured gas emissions, the carbon gas balance of the 2 mangrove forests was estimated. The densely vegetated Ras Dege forest appears to be an efficient sink of greenhouse carbon gases, while extensive clear-cutting at the Mtoni forest apparently has reduced its capacity to absorb CO2, although it is seemingly still a net sink for atmospheric CO2.