This article explains how to perform a clean install (also called a "custom install") of Windows 8 and Windows 8.1 on your computer. It's almost identical for both versions, but we've highlighted the differences where necessary.
Format and Clean Install Windows 8 by AvoidErrors
The most important thing to know before you begin is that all information on the drive where you are installing/reinstalling Windows 8 will be erased.
This means that the entire operating system that is currently on it, whatever that may be, will be gone, as will any programs you have installed and, more importantly, any valuable data you have stored on that drive.
The first thing you should do, if possible, is to back up any data you want to keep, such as your saved documents, downloaded music and videos, etc. It is usually not possible to back up your programs themselves. Therefore, find any installation media and downloaded installation files that you used to install the programs so that you can reinstall them after the clean install is complete.