How-To Geek

Edit ePub eBooks with Your Favorite HTML Editor

ePub eBooks are increasingly popular today, but often they’ve been made by converting other file formats. Here’s how you can edit ePub books to remove irregularities and make them better for reading on your devices.

ePub’s are actually a zip file containing images, XHTML files with your text, and more with the .epub extension. You can make them better by editing the XHTML files directly.  Code gurus can edit the code directly, but even if you’ve never edited HTML, you can still quickly make changes with a WYSIWYG editor.

Extract the Files from your ePub eBook

As mentioned before, ePub files are actually renamed zip files.  So first let’s get all of the files in your ePub eBook accessible.  Find an eBook you want to edit and then change the file extension to .zip.


If you don’t see the file extensions, click Organize in the menu bar and select Folder and search options.


Select the View tab, and then uncheck the box beside Hide extensions for known file types.  Click Ok, and then change the file type as above.


Windows will warn you about changing the file type; click Yes to proceed.


Now you can browse the files of the ePub file.  Notice that it contains mostly HTML or XHTML files and images.  Click Extract all files to save them all in a folder so you can easily edit them.


Alternately, you can open the ePub file directly in your favorite file archival program such as 7-zip.  Browse to the location of your ePub file, double-click it, and it’ll automatically open even if you don’t change the file extension to zip.  Now you can extract the folder, or extract individual files as before.


Edit Your eBook in KompoZer

The actual ebook contents are stored in HTML or XHTML files.  These may be stored on the top folder of you ePub file’s directory, or they may be stored in \OEBPS\text in the file.


To change the contents of your eBook, you’ll want to edit these files.  Often there may be separate files for each chapter, so you may have to use trial and error to find the one you need to edit.  You could edit them by hand in Windows using Notepad if you don’t have an HTML editor installed.


A better option would be to use an HTML editor.  Here we’ll use the free KompoZer program to edit the files just like we’d edit a document in Word.

Download KompoZer (link below), and unzip the files.  Then open the new folder and launch kompozer.exe; you don’t even need to install it.  In fact, you could even store KompoZer on a flash drive so you could edit HTML files from any computer.


In KompoZer, open the HTML or XHTML file from your eBook that you want to edit.


Now you can edit the file just like you would edit a document in Word.  Remove extra and unneeded text, make titles stand out, correct misspellings … anything you want!  This is especially helpful if your ePub file was created by converting a PDF as these often have many small errors.


Or, if you’d rather edit the code itself, select the Source tab and edit as you wish.


When you’re done making the changes, make sure to save the file in the same location with the same file name.


Recreate Your Edited ePub eBook

Once you’ve made all the changes you wanted, it’s time to turn this folder of files back into ePub.  Make sure you change the name of the folder if it still has the same name as the original ePub or zip file so you don’t mix them up or have trouble with overwriting the old files.

Zip the folder using Windows Explorer or your favorite archival utility.  If you are using another archival program, make sure to compress it as a zip folder; other compression methods will render the ePub unreadable by your eReader app.


Now change the file extension again, this time back to .epub. Now you can read your eBook with your changes in your favorite reader program or app on your mobile device.



Whether you need to remove an odd, misplaced character or need to do fine editing, using an HTML editor is a great way to make your ePub eBooks look just like you want.  Also, with an editor like KompoZer it’s not even difficult.

Download KompoZer

Matthew digs up tasty bytes about Windows, Virtualization, and the cloud, and serves them up for all to enjoy!

  • Published 06/14/10

Comments (18)

  1. Damien Ryan

    I’ve started using Sigil ( It’s only early alpha (0.2) but is quite handy for throwing a few html pages together into an epub for the iPad.

  2. Eva Browne-Paterson

    Hi Matthew

    Brilliant tutorial thank you! My client wasn’t altogether happy at the way his ebook displayed as an epub, mobi and pdb. But your method helped me to fix the epub copy at least. Much appreciated. :-)

    Kind regards
    Eva Browne-Paterson

  3. Waqas Saeed

    Hi Friend

    very nice i am able to edit the contents of my epub book and make some changes.


  4. Elaine

    It didn’t work. I tried opening the file and making changes in notepad and I tried it using Kompozer. It seemed like it worked but when I tried to validate it in an epub validater it failed and when I tried to add it to my other ebooks after the change, it wouldn’t load due to errors.

    I then tried experiments. I thought renaming from .epub to .zip may be the cause but it wasn’t. I tested it. I then opened it in kompozer and made no changes whatsoever. I then compressed it and renamed it back to .epub and it failed. Therefore my changes in the file had no bearing. There seems to be a fault with compressing it. It fails checks of validity and won’t be added with other epubs due to errors.

    Please let me know why I am having this trouble. I spent hours on this. Thanks.

  5. Beej

    Very nice tutorial. Thanks.

  6. Curt Sampson

    Note that this may not work on some devices because of the way you’re creating the new EPUB file after you’ve finished editing.

    According to the EPUB standard, the top-level file called “mimetype” must be the first file in the ZIP archive, and it must be stored uncompressed. Neither of these will be the case if you just tell your archiving tool to create a standard ZIP file from the files in a directory. So you’re creating what is, technically, an invalid EPUB file.

    Some devices will have no problems with this violation of the specification so long as everything else is ok. Others will.

  7. Jibi Abraham

    Hi friend,

    Setting elements with tab is not working in Epub, but it works in HTML editor. Could you please suggest a solution to give extra space between two words in a line?

  8. Russ

    Thanks for the details on the epub format!

    It appears, those devices who don’t like the compressed mimetype file that zipping the file in a an uncompressed format (zip type “store”) might do the trick. At least in my limited tested.

  9. Josh

    Awesome, thanks, just what I needed

  10. Sander

    Will not work. An epub is a zip file made with special options. Not all readers will accept it.

    It is better (and way easier…) to use Sigil. However, if you really want to use your html editor, there is another option. Download TweakEpub and open the epub with that. Select the file you want to edit and edit it with your editor of choice. Press save and your epub is changed.

  11. Ebrahim Pak

    First of all thanks alot for the article. Yes there are problems after converting the ZIP to EPUB without noting . For resolving the “Page Error” I encountered on my Sony Reader; I first made an empty ZIP file -with the exact same name as the former exploded epub file- and then FIRST OF ALL added the mime-type file to it. It should be the first file to be added to your ZIP archive. Then I added the other two folders; META-INF and then OEBPS (which contains all the pages and images). I added them in this order, each time by WINRAR (Archive Format: ZIP) and chose the compression method as “store”.

    After all I opened the epub file in the Calibre -keeping its meta data intact- and sent it to my device.

    This time the result was great. Try it!

  12. Ebrahim Pak

    I forgot to mention the last step. After all I had done, I converted the epub to the readable epub format of my reader in Calibre.

  13. Kay

    Thanks a lot.

    it’s useful.

  14. MJ

    Right on Damien. Thank you

  15. Azerjaban

    Thank you for this great tutorial really helpfull!

  16. Susheel Chandradhas

    Why do you not have a Google+ button here? I wanted to +1 this article and share it!!!!!

  17. Richard Hartzell

    FYI: I did everything Matthew suggested and everything was going swimmingly until I made a change to one of my epub file’s HTML chapter files in Sigil 0.4.2 and discovered, much to my amazement and horror, that Sigil is incapable of saving an HTML file *as an HTML file*! It can only save any document you open as an epub file. Why on earth Sigil can open an HTML file but can’t *save* it again as an HTML file is beyond me, but there you have it. Guess I’ll have to download a pedestrian HTML editor to continue this experiment.

    Anyway, thanks Matthew for your extremely clear instructions. Since you suggest using KompoZer and not Sigil you can hardly be blamed for *that* snafu.

  18. Chris

    Great article! I found that by configuring 7-zip to use KompoZer as its default editor, you can just open the epub file in 7-zip, edit the relevant chapter directly and save the changes without leaving 7-zip. No need to rename the file or reassemble the edited epub file.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!