A spiral galaxy like the Milky Way contains stars, stellar remnants, and a diffuse interstellar medium (ISM) of gas and dust. The interstellar medium consists of 10−4 to 106 particles per cm3 and is typically composed of roughly 70% hydrogen by mass, with most of the remaining gas consisting of helium. This medium has been chemically enriched by trace amounts of heavier elements that were ejected from stars as they passed beyond the end of their main sequence lifetime. Higher density regions of the interstellar medium form clouds, or diffuse nebulae,[3] where star formation takes place.[4] In contrast to spirals, an elliptical galaxy loses the cold component of its interstellar medium within roughly a billion years, which hinders the galaxy from forming diffuse nebulae except through mergers with other galaxies.[5]

In the dense nebulae where stars are produced, much of the hydrogen is in the molecular (H2) form, so these nebulae are called molecular clouds.[4] Observations indicate that the coldest clouds tend to form low-mass stars, observed first in the infrared inside the clouds, then in visible light at their surface when the clouds dissipate, while giant molecular clouds, which are generally warmer, produce stars of all masses.[6] These giant molecular clouds have typical densities of 100 particles per cm3, diameters of 100 light-years (9.5×1014km), masses of up to 6 million solar masses (M☉),[7] and an average interior temperature of 10 K. About half the total mass of the galactic ISM is found in molecular clouds[8] and in the Milky Way there are an estimated 6,000 molecular clouds, each with more than 100,000 M☉.[9] The nearest nebula to the Sun where massive stars are being formed is the Orion nebula, 1,300 ly (1.2×1016 km) away.[10] However, lower mass star formation is occurring about 400–450 light years distant in the ρ Ophiuchi cloud complex.[11]

A more compact site of star formation is the opaque clouds of dense gas and dust known as Bok globules; so named after the astronomer Bart Bok. These can form in association with collapsing molecular clouds or possibly independently.[12] The Bok globules are typically up to a light year across and contain a few solar masses.[13] They can be observed as dark clouds silhouetted against bright emission nebulae or background stars. Over half the known Bok globules have been found to contain newly forming stars.[14]

The first observed newborn star-forming clump, aged less than 10 million years old, was found in a galaxy about a corresponding light travel distance of 10.4 billion light years away, at an age when the universe was about 3.3 billion years old. The clump is about 3,000 light-years wide, and has a mass more than 1 billion times the mass of the sun, creating 32 stars each year with the mass of the sun, and produced about 40 percent of the stars in the clump's host galaxy.

Initial research indicates star-forming clumps start as giant, dense areas in turbulent gas-rich matter in young galaxies, live about 500 million years, and may migrate to the center of a galaxy, creating the central bulge of a galaxy.[16]

An interstellar cloud of gas will remain in hydrostatic equilibrium as long as the kinetic energy of the gas pressure is in balance with the potential energy of the internal gravitational force. Mathematically this is expressed using the virial theorem, which states that, to maintain equilibrium, the gravitational potential energy must equal twice the internal thermal energy.[17] If a cloud is massive enough that the gas pressure is insufficient to support it, the cloud will undergo gravitational collapse. The mass above which a cloud will undergo such collapse is called the Jeans mass. The Jeans mass depends on the temperature and density of the cloud, but is typically thousands to tens of thousands of solar masses.[4] This coincides with the typical mass of an open cluster of stars, which is the end product of a collapsing cloud.[18]

In triggered star formation, one of several events might occur to compress a molecular cloud and initiate its gravitational collapse. Molecular clouds may collide with each other, or a nearby supernova explosion can be a trigger, sending shocked matter into the cloud at very high speeds.[4] Alternatively, galactic collisions can trigger massive starbursts of star formation as the gas clouds in each galaxy are compressed and agitated by tidal forces.[19] The latter mechanism may be responsible for the formation of globular clusters.[20]

A supermassive black hole at the core of a galaxy may serve to regulate the rate of star formation in a galactic nucleus. A black hole that is accreting infalling matter can become active, emitting a strong wind through a collimated relativistic jet. This can limit further star formation. Massive black holes ejecting radio-frequency-emitting particles at near-light speed can also block the formation of new stars in aging galaxies.[21] However, the radio emissions around the jets may also trigger star formation. Likewise, a weaker jet may trigger star formation when it collides with a cloud.[22]

As it collapses, a molecular cloud breaks into smaller and smaller pieces in a hierarchical manner, until the fragments reach stellar mass. In each of these fragments, the collapsing gas radiates away the energy gained by the release of gravitationalpotential energy. As the density increases, the fragments become opaque and are thus less efficient at radiating away their energy. This raises the temperature of the cloud and inhibits further fragmentation. The fragments now condense into rotating spheres of gas that serve as stellar embryos.[23]

Complicating this picture of a collapsing cloud are the effects of turbulence, macroscopic flows, rotation, magnetic fields and the cloud geometry. Both rotation and magnetic fields can hinder the collapse of a cloud.[24][25] Turbulence is instrumental in causing fragmentation of the cloud, and on the smallest scales it promotes collapse.[26]

A protostellar cloud will continue to collapse as long as the gravitational binding energy can be eliminated. This excess energy is primarily lost through radiation. However, the collapsing cloud will eventually become opaque to its own radiation, and the energy must be removed through some other means. The dust within the cloud becomes heated to temperatures of 60–100 K, and these particles radiate at wavelengths in the far infrared where the cloud is transparent. Thus the dust mediates the further collapse of the cloud.[27]

During the collapse, the density of the cloud increases toward the center and thus the middle region becomes optically opaque first. This occurs when the density is about 10−13 g / cm3. A core region, called the First Hydrostatic Core, forms where the collapse is essentially halted. It continues to increase in temperature as determined by the virial theorem. The gas falling toward this opaque region collides with it and creates shock waves that further heat the core.[28]

When the core temperature reaches about 2000 K, the thermal energy dissociates the H2 molecules.[28] This is followed by the ionization of the hydrogen and helium atoms. These processes absorb the energy of the contraction, allowing it to continue on timescales comparable to the period of collapse at free fall velocities.[29] After the density of infalling material has dropped below about 10−8 g / cm3, that material is sufficiently transparent to allow energy radiated by the protostar to escape. The combination of convection within the protostar and radiation from its exterior allow the star to contract further.[28] This continues until the gas is hot enough for the internal pressure to support the protostar against further gravitational collapse—a state called hydrostatic equilibrium. When this accretion phase is nearly complete, the resulting object is known as a protostar.[4]

N11, part of a complex network of gas clouds and star clusters within our neighbouring galaxy, the Large Magellanic Cloud.

Accretion of material onto the protostar continues partially from the newly formed circumstellar disc. When the density and temperature are high enough, deuterium fusion begins, and the outward pressure of the resultant radiation slows (but does not stop) the collapse. Material comprising the cloud continues to "rain" onto the protostar. In this stage bipolar jets are produced called Herbig-Haro objects. This is probably the means by which excess angular momentum of the infalling material is expelled, allowing the star to continue to form.

When the surrounding gas and dust envelope disperses and accretion process stops, the star is considered a pre–main sequence star (PMS star). The energy source of these objects is gravitational contraction, as opposed to hydrogen burning in main sequence stars. The PMS star follows a Hayashi track on the Hertzsprung–Russell (H–R) diagram.[30] The contraction will proceed until the Hayashi limit is reached, and thereafter contraction will continue on a Kelvin–Helmholtz timescale with the temperature remaining stable. Stars with less than 0.5 M☉ thereafter join the main sequence. For more massive PMS stars, at the end of the Hayashi track they will slowly collapse in near hydrostatic equilibrium, following the Henyey track.[31]

Finally, hydrogen begins to fuse in the core of the star, and the rest of the enveloping material is cleared away. This ends the protostellar phase and begins the star's main sequence phase on the H–R diagram.

The stages of the process are well defined in stars with masses around 1 M☉ or less. In high mass stars, the length of the star formation process is comparable to the other timescales of their evolution, much shorter, and the process is not so well defined. The later evolution of stars are studied in stellar evolution.

The Orion Nebula is an archetypical example of star formation, from the massive, young stars that are shaping the nebula to the pillars of dense gas that may be the homes of budding stars.

Key elements of star formation are only available by observing in wavelengths other than the optical. The protostellar stage of stellar existence is almost invariably hidden away deep inside dense clouds of gas and dust left over from the GMC. Often, these star-forming cocoons known as Bok globules, can be seen in silhouette against bright emission from surrounding gas.[32] Early stages of a star's life can be seen in infrared light, which penetrates the dust more easily than visible light.[33] Observations from the Wide-field Infrared Survey Explorer (WISE) have thus been especially important for unveiling numerous Galactic protostars and their parent star clusters.[34][35] Examples of such embedded star clusters are FSR 1184, FSR 1190, Camargo 14, Camargo 74, Majaess 64, and Majaess 98.[36]

Star-forming region S106.

The structure of the molecular cloud and the effects of the protostar can be observed in near-IR extinction maps (where the number of stars are counted per unit area and compared to a nearby zero extinction area of sky), continuum dust emission and rotational transitions of CO and other molecules; these last two are observed in the millimeter and submillimeter range. The radiation from the protostar and early star has to be observed in infrared astronomy wavelengths, as the extinction caused by the rest of the cloud in which the star is forming is usually too big to allow us to observe it in the visual part of the spectrum. This presents considerable difficulties as the Earth's atmosphere is almost entirely opaque from 20μm to 850μm, with narrow windows at 200μm and 450μm. Even outside this range, atmospheric subtraction techniques must be used.

The formation of individual stars can only be directly observed in the Milky Way Galaxy, but in distant galaxies star formation has been detected through its unique spectral signature.

MWC 349 was first discovered in 1978, and is estimated to be only 1,000 years old.

VLA 1623 – The first exemplar Class 0 protostar, a type of embedded protostar that has yet to accrete the majority of its mass. Found in 1993, is possibly younger than 10,000 years [1].

L1014 – An incredibly faint embedded object representative of a new class of sources that are only now being detected with the newest telescopes. Their status is still undetermined, they could be the youngest low-mass Class 0 protostars yet seen or even very low-mass evolved objects (like a brown dwarf or even an interstellar planet). [2]

Stars of different masses are thought to form by slightly different mechanisms. The theory of low-mass star formation, which is well-supported by a plethora of observations, suggests that low-mass stars form by the gravitational collapse of rotating density enhancements within molecular clouds. As described above, the collapse of a rotating cloud of gas and dust leads to the formation of an accretion disk through which matter is channeled onto a central protostar. For stars with masses higher than about 8 M☉, however, the mechanism of star formation is not well understood.

Massive stars emit copious quantities of radiation which pushes against infalling material. In the past, it was thought that this radiation pressure might be substantial enough to halt accretion onto the massive protostar and prevent the formation of stars with masses more than a few tens of solar masses.[39] Recent theoretical work has shown that the production of a jet and outflow clears a cavity through which much of the radiation from a massive protostar can escape without hindering accretion through the disk and onto the protostar.[40][41] Present thinking is that massive stars may therefore be able to form by a mechanism similar to that by which low mass stars form.

There is mounting evidence that at least some massive protostars are indeed surrounded by accretion disks. Several other theories of massive star formation remain to be tested observationally. Of these, perhaps the most prominent is the theory of competitive accretion, which suggests that massive protostars are "seeded" by low-mass protostars which compete with other protostars to draw in matter from the entire parent molecular cloud, instead of simply from a small local region.[42][43]

Another theory of massive star formation suggests that massive stars may form by the coalescence of two or more stars of lower mass.[44]