I'm pretty lazy, especially when it comes to handsewing buttons. Luckily I can do them by machine! Some sewing machines have a special button you can press that automatically inputs all the settings you need to do buttons, but not everyone has one of those fancy-pants machines. Following these instructions you can do this on any machine that can do a zigzag stitch!
Step 1: Choosing Buttons
This method will only work with buttons that have holes all the way through from top to bottom. It will work with either two holes or four; you'll simply sew one pair of holes at a time. It will NOT work on buttons that have a shank. See photo for examples of each.
Step 2: Button Feet
There are actual "button feet" meant specifically for sewing on buttons. They have a small U-shaped base covered in a rubbery material. The shape of the foot allows you to easily see your button, and the rubbery surface helps grip the button so it doesn't go sliding away.
You can still do this if you don't have a special foot. Choose a foot that would allow you to do a wide zig-zag stitch and tape or glue a small U-shaped piece of rubber or foam to the bottom. It will be harder to see your button holes to set your stitches, but with a little practice you can do it. The first photo above shows both a real button foot and my faux button foot. The second image shows the real button foot attached to the machine, and the third shows the faux button foot on the machine. For purposes of this instructable I'll be using the real one simply because it will be easier for you to see what I'm doing.