TRBAsado :
I am thinking of changing the case as well because I am not sure about the case if it would fit the motherboard I'm buying but I am keeping the CPU ram and other stuff but I'm not sure if I have to format my hard drive before changing motherboards or is it okay to just change the motherboard ? I am pretty new to building pcs and I don't really know what to do after changing the motherboard like after booting the computer what do I do?
You are talking about building a new PC then, which will require buying a new OS (unless you decide to go with a free OS such as Linux or Ubuntu). Microsoft will not let you reuse the OS. And you will have to re-install the OS from scratch, since the underlying software (drivers, etc) will need to be completely different. Even if you put your old drive in and it worked somehow, it would not work well.
There are basically 3 sizes of MB's: ATX, Micro-ATX, and ITX. Rough guide is that ATX = 7 slots, MITX = 4 slots, ITX = 1 slot. The Z170 is an ATX, so you need a case big enough.
As I said before, you really need to read up on this; there are many things to consider when building a PC.