Over the next three posts, I’ll be showing you how ebooks are coded and formatted.
You’ve heard me call an ebook a website in a box. This time we’re going to talk about what’s inside the box.
First things first: let me share an ebook with you. It’s the ePub file for a short story of mine called White Robes. (Clicking on this link will download the file to your device.)
You’re welcome to read it, obviously, but for the purposes of this post (and the next two), we’re going to be opening up the box and dissecting the ebook.
This is the actual production file that I’ve uploaded to Amazon, by the way — it includes all of the coding and formatting that I typically include in creating an ebook. It will be the model that I’ll be using over the next few posts in discussing an ebook’s innards.
Opening the Box
What we’re going to look this time is the structure of the ebook — the collection of files that an ePub-ready ereader like Apple’s iBooks or Barnes & Noble’s Nook or Readium or Calibre or any of thousands of other apps can open. 
So now we have our website in a box. Let’s open the box and see what we’ve got! 
There are just three steps:
Step 1: Duplicate your file
Now, I’m going to assume that you’re using a Windows or Mac computer. 
We’re duplicating the file so that the original doesn’t get destroyed. Just a good habit to stay in, right?
In Windows, select the file in Windows Explorer by dragging over it or left-clicking on it once. From the Organize menu at the top of the window, select Copy. (You can do the same thing by right-clicking on the file and selecting Copy.)
In Mac OS X, select the file in the Finder by dragging over it or clicking on it once. Now hit command-D or go to the File menu and select Duplicate. (You can also control-click/right-click on the file and select Duplicate.)
You should now have a duplicate copy of the file:
Step 2: Convert to ZIP format
This is actually a much simpler process than you might think: an ePub file is just a carefully constructed ZIP archive with a different extension (the last three or four letters at the end of the file name).
If you don’t see the . epub extension at the end of your new file, click on/drag over the file to select it.
In Windows, go to the Organize menu and select Folder and Search Options. De-select the Hide known file extensions option. Click OK.
In Mac OS X, go to the File menu and select Get Info or hit command-I. If not already open, click on the triangle next to the Name and Extension heading to reveal the Hide extension option and deselect it. Close the Info window.
Now rename the file.
In Windows, right-click the file name and select Rename (or left-click and hold down the button for one second). Double-click the epub file extension (not including the period!) and replace it with the extension zip. Hit the Enter button.
CLICK TO KEEP READING