EPUB OPF Package Document: Structure, Metadata, and Spine Explained
Every EPUB file contains a package document — an XML file with a .opf extension (historically called content.opf or package.opf) that ties the whole ebook together. Reading systems parse it first to understand the book's structure. This guide explains each section and what EPUB 3 changed from EPUB 2.
What is the OPF document?
OPF stands for Open Packaging Format. It's an XML file inside the EPUB archive that answers three questions for the reading system:
- What is this book? (metadata — title, author, language, UUID)
- What files does it contain? (manifest — every resource listed)
- In what order should the content be read? (spine — reading order)
A minimal EPUB 3 OPF document:
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf"
xmlns:dc="http://purl.org/dc/elements/1.1/"
version="3.0"
unique-identifier="bookid">
<metadata>
<dc:identifier id="bookid">urn:uuid:a1b2c3d4-e5f6-7890-abcd-ef1234567890</dc:identifier>
<dc:title>My Book Title</dc:title>
<dc:language>en</dc:language>
<dc:creator>Author Name</dc:creator>
<meta property="dcterms:modified">2026-06-12T00:00:00Z</meta>
</metadata>
<manifest>
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
<item id="ch01" href="chapter01.xhtml" media-type="application/xhtml+xml"/>
<item id="ch02" href="chapter02.xhtml" media-type="application/xhtml+xml"/>
<item id="style" href="style.css" media-type="text/css"/>
<item id="cover" href="cover.jpg" media-type="image/jpeg" properties="cover-image"/>
</manifest>
<spine>
<itemref idref="nav" linear="no"/>
<itemref idref="ch01"/>
<itemref idref="ch02"/>
</spine>
</package>
Metadata section
The <metadata> element uses Dublin Core elements (prefixed dc:) for the core bibliographic fields:
| Element | Required? | Notes |
|---|---|---|
dc:identifier | Yes | Must match unique-identifier on <package>; use UUID or ISBN |
dc:title | Yes | Book title; repeat for subtitle with title-type refinement |
dc:language | Yes | BCP 47 code (e.g., en, fr, zh-Hans) |
dc:creator | Recommended | Author; use role refinement for editor, illustrator, etc. |
dc:publisher | Optional | Publisher name |
dc:description | Optional | Synopsis / back-cover copy |
dc:subject | Optional | Repeat for multiple subjects/categories |
dc:date | Optional | Original publication date |
meta property="dcterms:modified" | Yes (EPUB 3) | ISO 8601 UTC timestamp; must update on each revision |
EPUB 3 also supports accessibility metadata via meta elements with schema.org properties:
<meta property="schema:accessMode">textual</meta>
<meta property="schema:accessMode">visual</meta>
<meta property="schema:accessibilityFeature">structuralNavigation</meta>
<meta property="schema:accessibilityHazard">none</meta>
<meta property="schema:accessibilitySummary">This publication meets WCAG 2.2 Level AA.</meta>
Manifest section
Every file in the EPUB must appear in the manifest — HTML chapters, CSS, images, fonts, the nav document, and the NCX (if included). Each <item> has:
id— unique identifier within the OPF (used by spineidref)href— relative path from the OPF filemedia-type— MIME type of the resourceproperties— optional flags:nav,cover-image,scripted,mathml,svg
Common media types:
| File type | media-type |
|---|---|
| XHTML content | application/xhtml+xml |
| CSS | text/css |
| JPEG image | image/jpeg |
| PNG image | image/png |
| SVG | image/svg+xml |
| OTF font | font/otf |
| WOFF2 font | font/woff2 |
| NCX | application/x-dtbncx+xml |
| Nav document | application/xhtml+xml + properties="nav" |
Spine section
The <spine> defines the default reading order. Each <itemref> references a manifest item by its id:
<spine>
<itemref idref="nav" linear="no"/>
<itemref idref="cover" linear="no"/>
<itemref idref="ch01"/>
<itemref idref="ch02"/>
<itemref idref="ch03"/>
</spine>
The linear="no" attribute marks items that are not part of the linear reading flow (cover page, table of contents). Readers may skip them in sequential navigation.
Key changes in EPUB 3
- Nav document replaces NCX — the manifest must include an item with
properties="nav". - dcterms:modified is required — must be present and updated on every revision.
- Media overlays — new
media-overlayattribute on manifest items for read-aloud sync. - Accessibility metadata — schema.org properties are now standard practice.
- Guide element removed — the EPUB 2
<guide>element is replaced by the landmarks nav in EPUB 3.
FAQ
Where is the OPF file located inside an EPUB?
The META-INF/container.xml file (required in every EPUB) points to the OPF file's location with a rootfile element. The OPF is typically at OEBPS/content.opf or OPS/package.opf, but the path is not fixed.
Can an EPUB have multiple OPF files?
In EPUB 3, no — only one rendition (one OPF) is supported. EPUB 3.0.1 added multiple renditions as an experimental feature, but it was never widely implemented and was removed in EPUB 3.2.
What happens if a file is in the EPUB zip but not in the manifest?
EPUBCheck will report an error. Reading systems may ignore the file entirely. Every resource referenced from content must be in the manifest.
Do I need a spine entry for every manifest item?
No. CSS, images, fonts, and the nav document do not need spine entries. Only the HTML documents that form the reading sequence belong in the spine.
toolkit.bot generates EPUB3 output with correct OPF metadata, manifest, and spine — free, no account required.