The Open Packaging Format (package.opf) file serves as the central manifest, metadata store, and reading-order controller for an EPUB 3 publication. In automated publishing pipelines, build scripts generate package.opf from source XML or Markdown repositories prior to archiving the Open Container Format (OCF) .epub bundle. The META-INF/container.xml file points directly to package.opf via its full-path attribute, allowing reading systems to locate all publication assets.
Conformance with the W3C EPUB 3.3 specification is mandatory for ingestion by downstream distribution platforms and reading systems.
Complete Working Example
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="pub-id" xml:lang="en">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:identifier id="pub-id">urn:uuid:9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d</dc:identifier>
<dc:title>Automated Prepress Pipelines</dc:title>
<dc:language>en</dc:language>
<dc:creator>A. Developer</dc:creator>
<meta property="dcterms:modified">2026-11-20T12:00:00Z</meta>
</metadata>
<manifest>
<item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
<item id="cover-img" href="images/cover.jpg" media-type="image/jpeg" properties="cover-image"/>
<item id="css" href="styles/stylesheet.css" media-type="text/css"/>
<item id="ch01" href="text/chapter01.xhtml" media-type="application/xhtml+xml"/>
<item id="ch02" href="text/chapter02.xhtml" media-type="application/xhtml+xml"/>
</manifest>
<spine page-progression-direction="ltr">
<itemref idref="nav" linear="no"/>
<itemref idref="ch01"/>
<itemref idref="ch02"/>
</spine>
</package>
Parameter & Element Breakdown
| Flag / Element | Required | Function & Technical Behavior |
<package> | Yes | Root container element of the OPF package document, referenced by META-INF/container.xml via full-path. |
xmlns | Yes | Declares the default OPF XML namespace ([http://www.idpf.org/2007/opf](http://www.idpf.org/2007/opf)). |
version | Yes | Specifies the package specification version; must be "3.0" for all EPUB 3 releases, including EPUB 3.3. |
unique-identifier | Yes | Holds an IDREF matching the id attribute of the primary <dc:identifier> element used to identify the publication. |
xml:lang | No | Sets the default BCP 47 language code for human-readable text within package.opf metadata elements. |
<metadata> | Yes | Encapsulates Dublin Core bibliographic elements, rendering directives, and revision timestamps. |
xmlns:dc | Yes | Binds the dc prefix to the Dublin Core Metadata Element Set namespace ([http://purl.org/dc/elements/1.1/](http://purl.org/dc/elements/1.1/)). |
<dc:identifier> | Yes | Contains the primary publication identifier (UUID, ISBN, or URI); requires an id attribute matching unique-identifier. |
<dc:title> | Yes | Defines the publication title; at least one non-empty instance is mandatory. |
<dc:language> | Yes | Declares the primary language of the publication content using a valid BCP 47 language tag. |
<dc:creator> | No | Identifies the primary author, editor, or corporate entity responsible for creating the publication content. |
<meta property="dcterms:modified"> | Yes | Records the last modification timestamp in strict UTC ISO 8601 format (CCYY-MM-DDThh:mm:ssZ). Exactly one unrefined instance is required. |
<manifest> | Yes | Lists every publication resource bundled in the OCF archive except mimetype, META-INF/*, and package.opf itself. |
<item> | Yes | Registers an individual file resource inside the <manifest> block. |
id (<item>) | Yes | Assigns a document-unique XML NCName identifier to the resource for <spine> and manifest fallback references. |
href (<item>) | Yes | Specifies the relative IRI path from package.opf to the resource; must omit fragment identifiers. |
media-type (<item>) | Yes | Declares the IANA MIME type of the resource (e.g., application/xhtml+xml, text/css, image/jpeg). |
properties (<item>) | Conditional | Space-separated list of manifest properties. Exactly one XHTML item must carry nav; cover-image designates the cover asset. |
<spine> | Yes | Establishes the default linear reading order of the publication’s top-level content documents. |
page-progression-direction | No | Sets global page turn direction across the publication (ltr, rtl, or default). |
<itemref> | Yes | Appends a content document to the reading sequence; at least one primary (linear="yes") entry is required. |
idref (<itemref>) | Yes | References the id attribute of an XHTML or SVG <item> in <manifest>, or a foreign resource <item> with a fallback chain terminating in an XHTML or SVG Content Document. |
linear (<itemref>) | No | Indicates whether the item belongs to the primary reading flow (yes, default) or auxiliary non-linear content (no). |
Validation & Common Pitfalls
- Verify XML well-formedness and EPUB conformance: Validate syntax first with
xmllint--noout package.opf, then executeepubcheck --mode opf package.opffor standalone package checking orepubcheck publication.epubagainst the packaged container to verify cross-document resource resolution and exit with status0on valid builds. - Unmanifested assets, missing files, and
navproperty errors: Every stylesheet, font, image, and XHTML document bundled in the OCF container must appear as a<manifest><item>, and exactly one XHTML document must declareproperties="nav". Omitting a referenced resource from<manifest>triggersRSC-008, leaving unmanifested files inside the archive triggersOPF-003, referencing a file absent from the ZIP container triggersRSC-007, and omittingproperties="nav"triggersOPF-015orRSC-005(whereasOPF-014indicates an invalid or mismatchedpropertiesvalue on an<item>). - Invalid
dcterms:modifiedtimestamp syntax: The<meta property="dcterms:modified">element must contain a single timestamp formatted strictly asCCYY-MM-DDThh:mm:ssZin Coordinated Universal Time. Including local timezone offsets (such as+05:30), spaces, or fractional seconds fails EPUB 3.3 schema validation. - Un-falled-back foreign resources or empty primary
<spine>: Every<itemref>idrefattribute must resolve either to an EPUB Content Document (application/xhtml+xmlorimage/svg+xml) or to a foreign resource<item>whosefallbackattribute chain terminates in an EPUB Content Document. Referencing CSS files or raster images directly in<spine>without a valid fallback chain, or marking every<itemref>aslinear="no"without at least one primary reading item, breaks reading-system traversal. - Case-sensitive
hrefpaths, IRIs, and directory separators: Every<item>hrefattribute is a case-sensitive IRI resolved relative topackage.opfand must match the exact file path inside the OCF ZIP archive. Spaces are forbidden and must be percent-encoded (%20), backslashes (\) are invalid path separators, and while raw UTF-8 non-ASCII characters are permitted in IRIs, percent-encoding them preventsPKG-010andPKG-012filename portability warnings duringepubcheckvalidation.



