The U.S. National Aeronautics and Space Administration describes comets as consisting of a nucleus, coma and tail. Comets only have a tail and coma when they are close enough to the sun to heat up.
NASA explains that the nucleus of a comet consists of ice, dirt, dust and other solid particles. When comets are far from the sun, they are dark and cold, with only a nucleus. The coma is a cloud of dust, gas and vapor that forms as the nucleus is heated. Since comets are constantly in motion, heat also produces a tail of gas that trails behind the nucleus. The tail is the portion of the comet that is visible to astronomers because solar radiation excites the gas molecules, giving the tail a glow-like appearance. When a comet's path again takes it far enough away from the sun, the coma and tail disappear.
According to NASA, comets of all sizes have been spotted. The largest known nucleus is 25 miles in diameter, and a comet with a tail measuring an estimated 360 million miles has been observed. Comets originate in the outer solar system in two known zones: the Oort Cloud and the Kuiper Belt. NASA estimates that there are billions of comets outside of the solar system, but more than 4,000 have been identified within its boundaries.