Password protect an EPUB? What the format actually allows
Sooner or later most self-publishers ask it: the manuscript is finished, the EPUB is built, and before it goes to beta readers or direct buyers, how do you password protect an EPUB so it can’t just be passed around? The question keeps surfacing on MobileRead and in Adobe’s InDesign community, and the answers that rank for it are mostly marketing pages from DRM vendors — which is a clue in itself.
We did not want to leave that as an assertion, so we built the locked files and watched them fail.
We locked a book two ways. Both bricked it
An EPUB is a ZIP archive with rules — the same container you meet when an
EPUB downloads as a zip — and ZIP has carried
password encryption since the DOS era. So the obvious move works mechanically:
zip -e happily produced a password-protected copy of our 5,183-byte test
book, every entry encrypted, 5,491 bytes out.
The obvious move also destroys the book. EPUB identification relies on the
mimetype file sitting first in the archive, stored without compression, so
that the text application/epub+zip is readable at byte 38 of the raw file.
In our locked copy, byte 38 onwards is ciphertext — the sniffable signature is
gone. Dropped on our validator, the file comes back as “Problems found —
ERROR: Not a valid ZIP archive.”

That error message deserves a moment of honesty, because it is our tool and it
is technically wrong. The file is a valid ZIP archive — the command-line
unzip -l lists all eleven entries without complaint. What actually happens
is that JSZip, the archive library our tools (and a great many reading apps
and web readers) are built on, refuses the whole file the moment any entry is
encrypted. The underlying error is “Encrypted zip are not supported”; our
validator’s catch-all reports that as an invalid archive. The distinction
matters to nobody holding the file: either way, nothing opens it.
So we tried to be cleverer. The second fixture, 5,169 bytes, keeps everything
a reader needs for recognition in the clear — mimetype stored first and
unencrypted, container.xml, the package document and the navigation files
all readable — and encrypts only the five chapters and the stylesheet. A
password-protected book that still looks like an EPUB from the outside.
It fails identically. Same refusal from the validator, and the converter is just as blunt:

One more thing the experiment made plain: a ZIP password hides file contents, not file names. Anyone can list the locked archive and read its full structure — chapter names, image names, the lot. As protection goes, it manages to be simultaneously too much (readers refuse the book) and too little (the structure is on display).
Why the format forbids it
This is not readers being lazy. The EPUB 3.3 specification
rules out the password route in plain language. “EPUB creators MUST NOT
compress or encrypt the mimetype file” — and the mimetype must be the first
file in the container. The same section lists what else must stay readable:
META-INF/container.xml, encryption.xml itself, and the package document.
Encrypt those — as any whole-archive password does — and the result is, by
definition, not an EPUB. The anatomy that makes the format inspectable is the
same anatomy we walk through in what is inside an EPUB,
and the spec guarantees it stays inspectable.
What the spec does define is a bookkeeping layer: an optional
META-INF/encryption.xml that records which resources are encrypted and with
what algorithm, built on XML Encryption, whole files only. Our second fixture
was non-conformant on this count too — encrypted chapters, no declaration.
But notice what the framework leaves out. There is no standard for where the
key comes from. No passphrase prompt, no key derivation, nothing a reading
app could implement so that “enter the password” works across readers. That
hole is deliberate — it is where commercial DRM plugs in — and it is why a
rights.xml slot sits in the spec “reserved for future standardization of
DRM information”, empty since the format’s beginning.
The spec’s one native protection mechanism proves the point by its narrowness: font obfuscation, which scrambles embedded fonts so they are awkward to extract and reuse. The specification is careful to say it “does not claim that obfuscation constitutes encryption” and guarantees nothing about security. It exists for font licences, not for your manuscript.
The passphrase that actually exists
There is one place where “password-protected EPUB” describes something real:
Readium LCP,
the open DRM standard used by libraries and some retailers. LCP defines, in
its own words, “a simple passphrase-based authentication method for Reading
Systems to access encrypted resources” — the book’s resources are encrypted
per the OCF rules above, declared in encryption.xml, and the content key is
itself locked behind a hash of a passphrase the reader types.
Which sounds like exactly what the question wants, until you read how the key gets there: a license document generated per user by a licensing server, embedded in the book at fulfilment, opened by readers that implement LCP. It is a distribution-platform feature, not a checkbox an author can tick. You adopt it by selling through a channel that runs it, not by locking the file on your desk. Where the keys live and who holds them is the whole subject of ebook DRM explained, and LCP is the most honest version of it — but it is still DRM, with DRM’s dependence on vendor infrastructure.
| What you might try | What actually happens |
|---|---|
| Password the whole ZIP | Readers refuse the file; signature at byte 38 destroyed |
| Password only the chapters | Readers refuse it anyway; non-conformant without encryption.xml |
| Font obfuscation | Fonts only; spec says it is not encryption |
| Hand-rolled encryption.xml | Conformant bookkeeping, but no reader has your key |
| LCP / store DRM | Works — via a distributor’s licensing server, not DIY |
What to do instead
Being realistic about this: a file handed to a reader is a file that can be copied, and EPUB is designed on that assumption — it is an open container, which is also why it is safe to open and easy to repair. The practical protections live around the file, not in it.
Control the handout rather than the archive — a private link that expires, a per-reader copy, a direct-sales platform that stamps the buyer’s name into the book it delivers. Personalised copies deter sharing socially rather than cryptographically, and unlike a ZIP password they leave the book readable everywhere. If the content genuinely must not travel, PDF is the format with password handling built into its spec — our EPUB to PDF converter produces the PDF, and any desktop PDF app can add the password afterwards. And if real DRM is a requirement, choose the distribution channel first, because that is where DRM comes from.
One last use for all of this: the experiment runs backwards. If a “protection” tool or a vendor workflow has already been at your EPUB and the file now opens nowhere, drop it on the EPUB validator. A clean pass means the book is still a book. The error we manufactured above — a valid-looking file suddenly reported as not a valid archive — is exactly what a locked or mangled container looks like from the outside.
Frequently asked questions
Can I put a password on an EPUB the way I can on a PDF?
No. PDF defines encryption and password handling inside the format itself, which is why every PDF app knows how to ask for one. EPUB's container specification forbids encrypting the files a reader needs to recognise the book, and defines no way for a reading app to prompt for a password. A password-protected EPUB is a file readers refuse, not a file they unlock.
Why does my locked EPUB say it is corrupt or not a valid ZIP?
Because the reading app's archive library gives up the moment it meets an encrypted entry. The underlying error in the library our tools use is literally "Encrypted zip are not supported" — the app then reports the file as invalid or corrupt, since from its point of view it cannot be read. The archive itself is a perfectly well-formed ZIP; it is the encryption that makes it a brick.
Can I encrypt just the chapters and leave the structural files readable?
We built exactly that file — mimetype, container.xml and the package document in the clear, only the chapters and stylesheet locked — and it failed everywhere the fully locked file failed. Archive libraries refuse the whole file, the spec requires an encryption.xml declaring any encrypted resource, and no reader has a way to ask you for the password anyway.
Does EPUB have any built-in protection at all?
The container spec provides a framework: an optional encryption.xml file that records which resources are encrypted and how. What it deliberately does not provide is key delivery — there is no standard way for a book to carry a password prompt. Working protection systems such as Adobe's or Readium LCP supply the keys through a licensing server, which is why they only exist at distributor level.
Is font obfuscation a way to protect an ebook's content?
No. Font obfuscation is a narrow mechanism for making embedded fonts harder to extract and reuse, and it applies only to fonts. The specification itself states it does not constitute encryption and does not guarantee the resource is secure. Book text, images and styles are untouched by it.