Formation of the mountains and caves
Many million years ago (from about 23 million years ago), much of what is now Niah National Park was coral reef. Over 5 to 10 million years, the reef grew thicker and thicker, until it was over 800m thick - a massive deposit of limestone formed by the skeletons of billions of dead corals. Earthquakes and uplift over about 2 million years then lifted this huge reef above the surrounding land, forming Gunung Subis - the mountain system which forms the core of Niah National Park today.
The limestone is quite soft and readily soluble in rainwater. Erosion from rain and streams over the past 3 million years has cut some massive cave systems into the mountain; and those caves have become the home of numerous animals - and intermittently for the last 40,000 years, humans as well (see the other Background sections).
Niah's geology also plays an important role in the environment outside the caves as well. The weathering (erosion), steep sides, thin soils and chemical composition of limestone all make for a very difficult environment. This has given rise to a specialised vegetation type (limestone vegetation) which grows only grows on limestone mountains, like Gunung Subis. Similar vegetation can also be found on Gunung Api at Mulu, which is also a limestone peak. A number of specialist small plants grow on the limestone, including monophyllea (with their single large leaf), begonias, and bunga batu, with their pretty pink flowers. Fewer of the massive dipterocarp trees can grow on limestone than in other environments in Sarawak, such as on sandstone hills and the lowland areas.