Skip to main content

Search 436 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, guides, blog and product.

XML format

EPUB package

The spine of an EPUB: every resource in the book, the order they are read in, and the Dublin Core metadata a shop displays.

An EPUB is a zip, and the .opf package document is what makes it a book rather than a folder of HTML. It has three parts that do different jobs: <metadata> carries the Dublin Core record a retailer displays, <manifest> lists every resource in the container, and <spine> puts the readable ones in reading order.

Manifest and spine are easy to conflate and must not be. A file that is in the manifest but not the spine — a stylesheet, an image, a cover — is part of the book but not part of the reading order. A file in neither is invisible to the reader, and a file in the spine but not the manifest makes the EPUB invalid.

Constraints that bite

  • Every resource in the container must appear in the manifest, and every manifest item must exist. Both directions are checked by epubcheck.
  • Spine itemrefs reference manifest item IDs, not file paths.
  • dc:identifier must match the unique-identifier attribute on the package element, or the book has no stable identity.
  • EPUB 3 requires a nav document with properties="nav"; the EPUB 2 NCX is optional and kept only for backwards compatibility.
  • The href values are relative to the .opf file's own location, not to the zip root, and the .opf is usually not at the root.
Root element
<package>
Media type
application/oebps-package+xml
Extensions
.opf
Namespaces
  • http://www.idpf.org/2007/opf
XMLDir label

Specification: EPUB 3.3 package document

A minimal valid document

Every example on this site is checked against the same parser the workspace uses, so what you see below is known to be well-formed.

epub-opf.xml
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="pub-id">
  <metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
    <dc:identifier id="pub-id">urn:isbn:9780000000001</dc:identifier>
    <dc:title>Notes on the Analytical Engine</dc:title>
    <dc:language>en</dc:language>
    <meta property="dcterms:modified">2026-01-01T00:00:00Z</meta>
  </metadata>
  <manifest>
    <item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
    <item id="ch1" href="ch1.xhtml" media-type="application/xhtml+xml"/>
    <item id="css" href="style.css" media-type="text/css"/>
  </manifest>
  <spine>
    <itemref idref="ch1"/>
  </spine>
</package>

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.