Asteroids are generally considered to be made up of metals and rocky material, while comets are made up of ice, dust and rocky material. Both asteroids and comets were formed during the earliest history of the solar system, around 4.5 billion years ago. Asteroids formed much closer to the sun, where it was too warm for ices to remain solid. Comets formed farther from the sun where ices would not melt. Comets, which approach the sun, lose material with each orbit because some of their ice melts and vaporizes to form a tail. Asteroids typically remain much more solid and self-contained, even when near the sun.
A few other important differences between an asteroid and a comet exist. Comets sprout tails when the come in close to the sun. Asteroids, even those near the sun, don’t usually have tails, but some do, like asteroid P/2010 A2 and like 3200 Phaethon, the source of the Geminid meteor shower. Heat from the sun is what causes ice and other materials on a comet’s surface to vaporize. That vapor is what is seen as the comets tail.
Another difference between comets and asteroids is in their orbital patterns. Comets tend to have very extended and elongated orbits, many times going more than 50,000 AU from the sun (1 AU, or astronomical unit, equals the distance from the Earth to the sun).
Asteroids tend to have shorter, more circular orbits and they seem to want to group together in belts.
Bottom line: Asteroids tend to be closer to the sun, and rockier. Comets tend to travel farther from the sun and are icier. But some objects blur the distinction between asteroids and comets.