Scrap off the loose stuff down to bare sheetrock, if possible, then patch with drywall compound if necessary. When it dries, sand it smooth and use a GOOD primer, like Bin sealer 123. Also use a good quality eggshell finish paint, like Benjamin Moore, or Sherwin Williams. You can't use flat finish paint in a bathroom because of the dampness factor. This is probably the problem unless their is a leak near the cracking areas. Good luck!
Is it a lot so that it looks like an alligator skin? Or just a few areas?
If it's alligator skin you need to scrape off the layer that has cracked otherwise you'll always have problems. Someone has put a coat of paint on that has less flexibility than the one underneath.
If it's just a few areas there are a number of possible causes. Assuming you don't have moisture issues; scrape the areas down to a sound substrate, test the areas beyond the cracks to about 6-10 inches for good adhesion, then use a little lightweight spackle to smooth out the area if you can't feather sand them. If the area is large drywall compound might be easier to use.
Either way, once you have a sound substrate prime and paint. If it is an older home and you are unsure of the existing paint, if you do any sanding assume the existing paint has lead and protect yourself accordingly.
The last layer of paint must be about six years old. The paint used was Valspar American Tradition semi-gloss. I know that because whoever painted the bathroom left a labeled jar. I checked the Valspar Web site and it seems this is an acrylic paint. I have no idea what paint is under that last layer.
The cracking is in a few spots only, there is no peeling. Each affected area is about a 2 square feet. There's a moisture issue, it's a bathroom. I don't have a mold problem (as far as I can tell).
Questions: what's the proper grit for sanding wall paint? What type sandpaper should I use?
What is drywall compound?
I use medium grit regular sandpaper and have always had good results. For drywall sanding, I use a flat hand sander with special drywall sanding screens that don't clog up the sanding surface.
Drywall compound is the "mud" drywallers use to cover seams, patch holes, etc, in drywall installation. You can get a small four pound pail or so pre-mixed. It is thinner than spackle, and spreads easier over thin uneven surfaces than spackle. Some deep patches (it doesn't sound like you have any, though) require more than one mud application.
I like to use kitchen/bath semi-gloss rather than eggshell. Some of the newer paints like this also have extra or special mold/moisture prevention chemicals in it, as I recall. This paint scrubs better over time, and in smaller bathrooms, light colors can help the available light make the room seem brighter. Have used Valspar over the years with good success. Consumer Reports put out some pretty good test results on interior paints. Test results don't always show that more expensive paints are best values.
I've lived in this place for six years. I noticed some cracks appearing about a year ago. We got terrible temperature cycling. During daytime we have up to 90°F, at night the temperature drops often into the 40s. Humidity varies between 40 and 70%.
I'm now armed with 80 grit sandpaper, spackling, primer, and paint.
Looks like problems from moisture/humidity . This is common in bathrooms.
Sand it down until you are SURE there are no loose spots.
Mud and finish to your best ability.
Primer is not really necessary. You can't go wrong priming it, but what will it really do?
But good paint is necessary. Benjamin Moore's best will work great.
Avoid flat paint.
I had the same thing in my bathroom and laundry room.
A previous owner painted the walls with semi gloss waterbase acrylic enamel over an oil based enamel. It's one of those failed adhesion polymer matrix of two differing types of paint thingy's... with a similar cracking and crazing of the paint.
I scraped and power sanded both rooms down to the oil based paint and used BIN White Shellac-Based Primer Sealer to seal. (This shellac-based primer is like glue. It's alcohol based and requires a respirator, ventilation, and eye protection). Then a skimcoat of All-Purpose joint compound with a follow up sanding and BIN 123 primer.
I went with the white shellac primer because of it's superior adhesion on oil base paint that would allow a waterbase topcoat to adhere. But most quality waterbased primers will do the job. And, if you do a skimcoat of joint compound, make sure it's an all purpose joint compound and not a topping compound. Joint compound has more latex bonding agent (glue) with better adhesion than a topping compound which will not last over a painted surface.