Curious Minds

Clear answers to science and history questions

How to Delete a Page in an EPUB Document

· 6 min read · Science

Deleting a page from an EPUB file is not the same as deleting a page in a word processor. An EPUB is a ZIP archive containing XHTML files, a manifest, and a spine that defines the reading order. There is no single "page" object to remove; instead, you remove the content file that represents the page, or you remove the corresponding entry from the spine so it no longer appears in the book. This guide explains how to do that safely with standard tools, what to check before you start, and how to avoid breaking the file.

What You'll Need

  • A backup copy of the original EPUB file.
  • A ZIP archive tool that can open and repack EPUB files without adding extra folders (for example, the built-in Archive Utility on macOS, 7-Zip on Windows, or the zip command line on Linux).
  • A plain-text editor or an XML editor (such as Notepad++, VS Code, or Sublime Text) to edit the OPF package file and XHTML content files.
  • An EPUB reader or validator (such as EPUBCheck, Calibre's ebook-viewer, or a dedicated e-reader app) to test the result.
  • Basic familiarity with file paths and XML tags. No programming is required, but care is.

Step-by-Step

  1. Make a backup. Copy the original EPUB to a separate folder and keep it unchanged. All edits should be made on a duplicate so you can restore the original if something goes wrong.
  2. Change the file extension to .zip. Rename a copy of the EPUB from book.epub to book.zip. This lets your archive tool open it as a normal ZIP file. Do not skip this step; some tools refuse to open files with the .epub extension.
  3. Extract the archive. Unzip the file into a new folder. You should see a mimetype file, a META-INF folder, and a folder (often named OEBPS or EPUB) containing the content.
  4. Locate the package file. Inside META-INF, open container.xml in a text editor. It points to the OPF package file, usually something like OEBPS/content.opf. Open that OPF file.
  5. Identify the page you want to delete. In the OPF file, find the <manifest> section. Each item has an id, an href (the file path), and a media-type. The <spine> section lists itemref elements in reading order, each pointing to a manifest id. Match the page you want to remove to a specific XHTML file, for example chapter5.xhtml.
  6. Remove the spine entry. Delete the <itemref> line in the <spine> that references the page's id. This alone will stop the page from appearing in the reading order. Save the OPF file.
  7. Remove the manifest entry (optional but recommended). Delete the corresponding <item> line in the <manifest> so the file is no longer declared. If other files link to it (for example a table of contents), those links will break, so check for references before deleting.
  8. Delete the XHTML file. In the content folder, delete the XHTML file that represented the page. If you only removed the spine entry, the file can stay, but removing it keeps the archive clean.
  9. Check the table of contents. Open the navigation document (often toc.xhtml, nav.xhtml, or an NCX file such as toc.ncx). Remove any link that points to the deleted file. If you leave a broken link, some readers will show an error or a blank page.
  10. Repack the EPUB correctly. The mimetype file must be the first file in the archive and stored without compression. Using a command-line tool: navigate to the extracted folder and run zip -X0 book.epub mimetype followed by zip -r9 book.epub META-INF OEBPS (adjust the folder name). With a graphical tool, ensure the mimetype file is at the root and not inside an extra folder.
  11. Rename back to .epub if needed. If your tool saved the archive as book.zip, rename it to book.epub.
  12. Validate and test. Run the file through EPUBCheck or open it in two different readers. Check that the deleted page is gone, that the surrounding chapters still appear in order, and that the table of contents works.

Common Mistakes

  • Deleting only the XHTML file. If the spine still references it, the reader will look for a missing file and may show an error or skip content unpredictably. Always update the OPF.
  • Forgetting the table of contents. A leftover link to a deleted page creates a broken navigation entry. Check both the NCX and the XHTML nav document if the book has both.
  • Repacking with the wrong structure. Adding an extra top-level folder, or compressing the mimetype file, can make the EPUB invalid. The mimetype must be first and uncompressed.
  • Editing the original file. Without a backup, a mistake can leave you with an unreadable book. Work on a copy.
  • Assuming "page" means a printed page number. In reflowable EPUBs, page numbers are not fixed. Deleting a "page" means deleting a content document or a section, not a fixed layout unit.

Tips

  • If you only want to hide a page temporarily, removing the spine entry is enough and is easier to reverse than deleting the file.
  • Use a validator early. EPUBCheck will flag missing manifest items, broken links, and packaging errors before you try to read the book.
  • Keep a list of the id values you remove so you can search the whole extracted folder for references to them.
  • For fixed-layout EPUBs, pages are often defined by XHTML files with fixed dimensions. The same spine-and-manifest approach applies, but check that no script or CSS depends on the removed file.
  • If the book uses an NCX file for navigation, update both the NCX and any XHTML nav document to avoid inconsistent menus across readers.

Troubleshooting

  • The book opens but shows a blank page where the deleted page was. A spine entry or a link still points to the removed file. Reopen the OPF and the navigation documents and remove the leftover reference.
  • The reader says the file is corrupted or invalid. The archive was probably repacked incorrectly. Re-extract your edited folder and repack, making sure mimetype is the first entry and stored without compression.
  • The table of contents link does nothing. The navigation file still points to the deleted XHTML. Edit the nav or NCX file to remove that entry.
  • Chapters appear out of order. You may have removed the wrong itemref from the spine. Compare the spine order with the original backup and restore the correct entry.
  • The file will not open at all. Restore from your backup and start again, changing one thing at a time and testing after each change.

Frequently Asked Questions

Can I delete a page without editing XML?

Some EPUB editors, such as Calibre's Edit Book feature, let you remove a file and automatically update the spine and manifest. That is safer for beginners, but the underlying result is the same: the content file and its references are removed.

Does deleting a page change the page numbers in the book?

In reflowable EPUBs, page numbers are not fixed and depend on the reader's settings, so there is no stable page numbering to change. In fixed-layout EPUBs, removing a page may shift the displayed page count.

Will deleting a page break the table of contents?

Only if the table of contents still links to the deleted file. Remove the corresponding entry from the navigation document to keep the menu working.

Can I delete a page from a DRM-protected EPUB?

No. DRM encryption prevents editing the content files. You would need a DRM-free copy, which is a separate legal and technical matter.

What happens if I only remove the manifest entry but not the spine entry?

The EPUB becomes invalid because the spine references an item that is no longer declared. Readers may refuse to open it or may behave unpredictably. Always keep the manifest and spine consistent.

Is it safe to delete the mimetype file?

No. The mimetype file is required and must be the first file in the archive, stored uncompressed. Removing it will make the EPUB invalid.

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions