Framing a doorway is similar to framing a solid wall, with a few added elements. Like the rest of the wall, it is easier to make a rough opening for a doorway while the wall is flat on the floor, if you have the room. Select the straightest studs you can find for framing doorways; this will avoid problems later.
When you build the wall, the bottom plate runs across the bottom of the doorway. This keeps the entire wall in one plane as you install it. To make it easier to remove the bottom plate under the door, cut most of the way through it in the correct places with a circular saw. Do this before installing the studs, which later won't leave you room to make the cuts with a power saw. After the wall is anchored securely, you can finish the cuts easily with a handsaw and remove the plate from the door opening.
About 1 hour
Tape measure, layout square, circular saw, handsaw, hammer, level
Measuring and marking, crosscutting, driving nails
Determine the size of the rough opening
2x4s, 16d, 10d, 8d nails
The king studs run from plate to plate. Nail them in place as you would regular studs. Cut the jack studs to a length equal to the rough opening height minus 1-1/2 inches to allow for the bottom plate. Nail the jack studs to the bottom plate with 16d nails and to the sides of the king studs with 10d nails.
For a header in a nonbearing wall, face-nail two 2x4s with 10d nails and drive 16d nails through the studs. In a bearing wall, make the header from a pair of wider boards with a piece of 1/2-inch plywood in the middle (2x10s are usually adequate, but check your local building code).
Nail one cripple stud to each king stud with 10d nails to hold the header firmly down on the jack studs. Attach them to the top plate with 16d nails. The infill cripple studs continue the 16-inch on center (OC) spacing of the wall studs regardless of where the door is located. Space the infill cripple studs accordingly. Attach them with 16d nails through the top plate and 8d toenails into the header. Make sure the sides of the door opening are plumb. Tip the wall into place.
After the wall is anchored in place, remove the length of bottom plate that crosses the doorway. Use a handsaw to finish the cuts you made in Step 1. Be careful not to cut into the floor on either side of the doorway.
To avoid damaging a finished floor, make saw cuts (see Step 1) on the underside of the bottom plate instead of the top. This is a little trickier because you have to extend the layout cuts around the plate, cut exactly to the line, and nail the stud exactly in the right spot.