How to Edit an EPUB File — Sigil, Calibre, and VS Code
An EPUB is a ZIP archive containing HTML, CSS, and image files. You can open and edit one in several ways depending on what you need to fix — from a simple heading tweak to a full layout overhaul.
What's actually inside an EPUB?
An EPUB file renamed to .zip can be extracted with any archive tool. Inside you'll find:
OEBPS/or similar — folder containing HTML content files, CSS stylesheets, and imagescontent.opf— the package manifest (metadata, spine order)toc.ncxornav.xhtml— the table of contentsMETA-INF/container.xml— the entry point that points to content.opf
Option 1: Sigil (best dedicated EPUB editor — free)
Sigil is purpose-built for editing EPUB files. It is free, open source, and available for Windows, Mac, and Linux.
- Download from sigil-ebook.com
- Open an EPUB directly — Sigil shows the book tree, HTML editor, CSS editor, and live preview side by side
- Edit HTML content with syntax highlighting
- Fix metadata (title, author, language, publisher) from the Metadata editor
- Search and replace across the entire book
- Run EPUBCheck validation to catch errors before publishing
- Supports EPUB 2 and EPUB 3
Best for: fixing heading structure, editing body text, correcting chapter titles, updating metadata, cleaning up CSS styling.
Option 2: Calibre's built-in editor
If you already have Calibre installed, it includes an EPUB editor.
- Right-click any book in your Calibre library
- Choose Edit book
- The editor opens with a file tree, HTML/CSS editor, and preview panel
- Similar to Sigil but with tighter Calibre integration (metadata syncs to your library)
Calibre's editor is less polished than Sigil for heavy editing but convenient if you're already in Calibre managing your library.
Option 3: VS Code or any text editor (manual)
For quick edits, you can work directly with the unzipped files:
- Rename
book.epubtobook.zip - Extract the ZIP
- Edit the HTML/CSS files in VS Code (install the EPUB Viewer extension for preview)
- Re-ZIP the folder — but be careful: the
mimetypefile must be the first file in the archive and must not be compressed
The re-zipping step is fiddly. On macOS/Linux:
cd extracted_epub_folder zip -X0 ../fixed.epub mimetype zip -rX9 ../fixed.epub * --exclude mimetype
On Windows, use 7-Zip: add mimetype first with no compression, then add the rest.
Common things people edit in EPUBs
- Heading hierarchy — change <h2> to <h1>, fix chapter titles
- Metadata — correct author name, title, language code
- Styles — remove hard-coded font sizes, fix margins, remove page breaks
- Table of contents — add missing entries, fix broken links
- Alt text — add accessibility alt attributes to images
- Footnotes — convert plain text footnotes to proper EPUB aside elements
When manual editing is not the right tool
Manual editing in Sigil works well when you know exactly what to fix. It becomes impractical when:
- The source EPUB has hundreds of structural issues from a poor PDF conversion
- The document needs to pass a specific compliance standard (Section 508, EPUB Accessibility 1.1)
- You need a second pair of eyes to read the whole book and catch all problems
In those cases, consider Premium Verification — a human reviewer reads the full EPUB, applies fixes, and returns a publication-ready file within 24–48 hours.
Need an EPUB from a PDF first? Start with a free conversion.
Convert PDF to EPUB →