Mangroves protect shorelines from damaging storm and hurricane winds, waves, and floods. Mangroves also help prevent erosion by stabilizing sediments with their tangled root systems. They maintain water quality and clarity, filtering pollutants and trapping sediments originating from land.
This lab experiment shows clearly how mangroves work:

Wind and swell waves are rapidly reduced as they pass through mangroves, lessening wave damage during storms. Wide mangrove belts, ideally thousands of meters across, can be effective in reducing the flooding impacts of storm surges occurring during major storms. This can significantly reduce flood extent in low lying areas. Narrower mangrove belts, hundreds of meters wide, will still be able to reduce wind speed, the impact of waves on top of the surge and flooding impact to some degree. The dense roots of mangroves help to bind and build soils. The above ground roots slow down water flows, encourage deposition of sediments and reduce erosion. Over time mangroves can actively build up soils, increasing the thickness of the mangrove soil, which may be critical as sea level rise accelerates.

Mangroves are among the most valuable ecosystems in the world. Decision makers, and the public, need to take full account of the many benefits that mangroves provide, and consider the true costs that may incur from mangrove loss.
