1. General vegetarians (Non-vegans)
For non-vegans, dairy products seems to be the best source, as mentioned in other answers as well. List of top 4 (I'm excluding eggs):
1: Cheese
The amount of vitamin B12 in cheese depends on type and variety, Swiss cheese provides the most with 3.34μg per 100g serving (56% DV), followed by Gjetost(40% DV), Mozzarella(39% DV), Tilsit(35% DV), and Feta(28% DV).
2: Whey Powder
Once thought the sole domain of body builders, whey powder is now entering main stream as more people are going vegetarian. Whey powder is a common addition to breads and smoothies, 100 grams will provide 2.5 μg of vitamin B12 or 42% of the DV.
3: Milk and Yogurt
100 grams of non-fat yogurt provides 0.53μg (10% DV) of vitamin B12 and 15%DV per cup. 100 grams of reduced fat milk provides 0.46μg (8% DV) and 19% DV per cup.
4: Yeast extract Spreads (Marmite)
Yeast extract spreads are popular in Britain and Europe, and have started to gain popularity in the U.S. A good vegetarian source of protein, the spread also packs a lot of vitamin B12. One hundred grams provides 0.5μg (8% DV) of vitamin B12, that is 0.03μg (1% DV) per teaspoon.
2. Vegans
As a vegan, I personally rely on nutritional yeast and multivitamins. There are some important points which are worth learning more about:
Is B12 Vegan?
The vitamin B12 component in B12 supplements and fortified foods is made by bacteria and sourced from bacteria cultures; it is not taken from animal products. However, some companies might put gelatin in their B12 supplements, though this appears to be less and less common. It is easy to find vegan B12 supplements on the Internet or in grocery stores in developed countries.
There are some live food supplement companies that rely on spirulina or other algae, rather than bacteria cultures, as a source of vitamin B12. You should not rely on such products for your vitamin B12 as testing has indicated it is not a reliable source of active vitamin B12 (more information).
Streptomyces griseus, a bacterium once thought to be a yeast, was the commercial source of vitamin B12 for many years (8, 9). The bacteria Propionibacterium shermanii and Pseudomonas denitrificans have now replaced S. griseus (10). At least one company, Rhone Poulenc Biochimie of France, is using a genetically engineered microorganism to produce B12 (11).
Fortified Foods
There are many vegan foods fortified with B12. They include non-dairy milks, meat substitutes, breakfast cereals, and one type of nutritional yeast.
The "Daily Value" for B12 found on food labels is based on 6 µg, which was the RDA in 1968. If a label says a food has, for example, 25% of the Daily Value of B12, it has 1.5 µg (25% of 6 µg = 1.5 µg).
Brewer's and Nutritional Yeasts
Brewer's and nutritional yeasts do not contain B12 unless they are fortified with it. There is at least one vegan, B12-fortified yeast currently on the market: Red Star Vegetarian Support Formula. (Twinlab's SuperRich Yeast Plus contains whey).
Cooking
Tucker et al. (2000, USA, 13) found that vitamin B12 from fortified breakfast cereals and dairy products was associated with better vitamin B12 status than was B12 intake from red meat, poultry, and fish, leading the researchers to suspect that the B12 from meat might be damaged by cooking. The B12 in animal foods tends not to be cyanocobalamin, the form used in fortified foods and that is more stable during cooking. For example, in an acid medium (pH 4-7), cyanocobalamin can withstand boiling at 120° C (1).
Even so, for people wondering whether they are destroying the B12 in their fortified foods by cooking, we do not have enough evidence to know for certain, so it is safest to make sure you rely on uncooked sources of vitamin B12.