Test files › Ebooks › valid.epub

Sample EPUB file (valid)

A valid EPUB 2 with metadata, an NCX table of contents and three chapters.

↓ Download valid.epub
Filenamevalid.epub
FormatEPUB
Size2.1 KB (2,148 bytes)
MIME typeapplication/epub+zip
SHA-256ad719e81f75520420d5d4688da7043e5acb7956cc26e7ca6b6523d48d647253d
What this file catchesEreaders and ingestion pipelines. EPUB has the same stored-first mimetype rule as ODF, plus a container.xml indirection to the package document - two things naive ZIP handling gets wrong.

Handle it in code

Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.

Python

Follow container.xml to the package document and confirm it exists, which is exactly what a reader does first.

import re, zipfile

with zipfile.ZipFile("valid.epub") as z:
    first = z.infolist()[0]
    if first.filename != "mimetype" or first.compress_type != zipfile.ZIP_STORED:
        raise SystemExit("rejected: mimetype must be the first entry, stored uncompressed")
    container = z.read("META-INF/container.xml").decode("utf-8")
    opf = re.search(r'full-path="([^"]+)"', container).group(1)
    print("ok" if opf in z.namelist() else f"rejected: container.xml points at {opf}, which is missing")

Run against this file, it prints: ok

Related guides and tools

Sample EPUB fileFile signaturesCheck a file's real typeVerify its SHA-256

Download & verify

curl -fsSL -o "valid.epub" "https://files.hexaqa.com/ebook/valid.epub"
curl -fsSL "https://files.hexaqa.com/ebook/valid.epub" | sha256sum # expect: ad719e81f75520420d5d4688da7043e5acb7956cc26e7ca6b6523d48d647253d

More ebooks test files

broken-container.epubsample.fb2

← All Ebooks files