When you upload a book to KDP, it gets
converted into the appropriate formats.
The tool Amazon uses (KindleGen) which Amazon uses to convert books can also be downloaded here:
http://www.amazon.com/gp/feature.html?docId=1000765211
Many authors convert books using kindlegen and then upload the result -- this allows them to test it out before publishing, either on a Kindle device or using
Kindle Previewer.