Cut the paint seam where the baseboard meets the wall, using a utility knife and cutting away from your hands and body. This will prevent the paint from chipping when the baseboard is removed.
Place a scrap of cardboard above the first nail that is securing the baseboard; this will prevent damage to the wall.
Hold the curved edge of a small pry bar to the top edge of the baseboard above the first nail. Tap the top of the curve gently with a hammer. The baseboard will pull 1/2 inch away from the wall at the top; the bottom edge will hit the tack strip and stop.
Repeat the process at the next nail and each subsequent nail along the length of baseboard. This will loosen the entire board 1/2 inch from the wall.
Pull the board the rest of the way off the wall. Work in 2-foot increments to pull the top edge from the wall until the entire nail length disengages from the wall. You will now be able to lift the baseboard from the wall.
Continue the process around the room until all baseboards have been removed, numbering each piece for ease of replacement.
Cut each piece of new baseboard to size. Use the old pieces for templates. Be sure to copy the proper corner angles with a miter saw.
Position each piece of new baseboard by first wedging the bottom of the board between the carpet tack strip and the wall, then pressing the top of the baseboard against the wall.
Nail the new baseboard into place, using finish nails and nailing 1 inch to the side of the original nail holes. Repeat the process until all new pieces have been installed.