Hold down Command + alt + R during startup or restart.
If you are using a Windows keyboard, press and hold the Windows key + Alt + R.
A globe and a loading bar are displayed.
And then an apple with another loading bar.
The OS X Utilities window then appears. Select Disk Utility.
Select APPLE HDD and press Delete.
Give the disc an optional name. Here it is named Macintosh HD.
Under Format, select OS C - Journaled.
Under Plan, select GUID Partition Overview.
Press OK when the deletion is complete.
Click the red cross in the upper left to return to the Utilities menu.
Click Reinstall OS X.
Choose your disk and tap Install.
Mac OS X will now begin installing. This can take a long time. The computer restarts several times during the process.
When the installation is complete, this image is displayed. Press Continue.
Select the keyboard language and press Continue.
Select "Do not transfer any information now" and press Continue.
Select whether you want to use location services and click Continue
Sign in with your Apple ID or select "Do not sign in". If you select "Do not log in", select "Skip" in the pop-up window.
Create your account and press Continue
Select time zone and press Continue.
Choose whether to send diagnostics to Apple. Press Continue.
Reinstallation is complete.