Stars are born in dense, cool clouds of molecular gas and dust. When the local density is high enough, the matter can gravitationally collapse to form a new star, a so-called young stellar object (YSO). In its early phases, a thick envelope dominates the infrared emission from the YSO, hiding what is going on within, but eventually the envelope flattens out into a warm circumstellar accretion disk. The disk emits more infrared than does the young star, and that excess radiation can be used to distinguish young stars from more mature stars whose disks and envelopes have disappeared. In recent years it has become possible to investigate these envelopes and disks in more detail, and astronomers have been building on these studies to address how planetary systems develop.