Stars form from an accumulation of gas and dust, which collapses due to gravity and starts to form stars. The process of star formation takes around a million years from the time the initial gas cloud starts to collapse until the star is created and shines like the Sun