Nebulae are vast clouds of gas and dust, primarily hydrogen and helium, that exist in interstellar space. These clouds collapse under their own gravity, leading to the formation of stars.