This how-to shows you the steps using Disk Utility 13 in OS X 10.10 Yosemite, but the process is the same if you’re using OS X 10.9 Mavericks or 10.8 Mountain Lion.
Here are the instructions using OS X 10.11 El Capitan.
Sometimes you want to wipe out all the data that’s on a hard drive or solid-state drive—erase it and start over. The best way to do this is to format the drive, which both erases the drive and prepares it for storing data by mapping out bad sectors, creating address tables for locating the data on the disk, and more.
Similarly, you may have purchased a new drive that was formatted for Windows out of the box. You’ll want to reformat that drive for your Mac.
But formatting a drive so that it can be used as your Mac’s startup drive requires a slightly different procedure than formatting it for use as a secondary drive for storing data.