Primer is an undercoat that you paint onto the wall before painting it with color. It seals the surface so the paint adheres to the surface instead of soaking into the wall.
If you’re painting drywall that’s never been painted before, prime it first.
If you have touched up a lot of cracks and filled in a lot of nail holes on a wall, prime the wall, or at least the areas you have covered with putty or drywall compound, before painting it.
If you’re painting a wall that hasn’t been painted for a long time, it’s not a bad idea to prime it, although you also could get away with a thorough cleaning.
If you’re applying flat paint on a wall that previously was painted with a high or semi-gloss finish, prime it first. It’s also a good idea to rough up the finish a bit with sandpaper or a good scrubbing with the cleaner TSP (trisodium phosphate), even before you prime it. Flat paint won’t adhere well to a glossy wall if you don’t.
If you’re changing the color of your wall from very dark to very light, priming it first will make it easier to cover with the lighter color and could save you from applying a second or even third coat of paint.
A tip: Ask the paint store to add a little bit of umber to the primer so it will be a light gray color. Once the gray-tinged primer is on the wall, it will accentuate any imperfections, giving you one final chance to make it perfectly smooth before applying the paint. And once you paint over the primer, you’ll be able to clearly see any areas where the paint has rolled on too thin.