# What is XHTML in EPUB?

Source: https://epubcc.com/glossary/xhtml/ (updated 2026-11-04)

EPUB content documents are XHTML: HTML written with XML syntax, so every tag must be closed, attributes quoted and the file well-formed. EPUB 3 uses the XHTML syntax of HTML5; EPUB 2 used XHTML 1.1.

## Why it matters when you convert a PDF to EPUB

The text a converter extracts from a PDF must be escaped and nested correctly, or the whole chapter fails to parse; one stray "&" or an unclosed tag is enough. Parsing errors appear in EPUBCheck as RSC-005 (schema errors) or RSC-016 (fatal XML errors).

How EpubCC handles it: each chapter is written as XHTML with the HTML5 doctype, lang and xml:lang set to the detected language, and dir="rtl" for right-to-left languages. Every piece of text taken from the PDF is escaped (&, <, > and quotes), and characters XML does not allow, such as stray control characters left in some PDFs, are dropped, so a chapter never fails to parse because of its source text.
