Gems in Diablo II are socketable items that add magical effects to socketed weapons, shields, and helms. Helms and shields can have anywhere from one to four sockets, while weapons can have one to six sockets.The expansion, Lord of Destruction, added socketed armor and improved gem buffs.
There are seven types of gems, each with a different effect relating to its color, and five grades of gems which determine the degree of effect. You can't remove gems once they go into a socket, so take careful consideration before you use them. Save more valuable gems for rare and powerful equipment and vice versa.