EPUB Error: Malformed XHTML — Unclosed Tags in Chapter Files

RSC-005: Error while parsing file: element "br" must be followed by either attribute specifications, ">" or "/>". Element type "img" must be terminated by the matching end-tag

What causes this error?

RSC-005 malformed element errors occur when EPUB chapter files contain HTML-style void elements — <br>, <img>, <hr> without self-closing slashes — instead of the XHTML-required <br/>, <img/>, <hr/>. Apple Books validates HTML inside chapter files and rejects on these; Calibre's viewer renders permissively and doesn't surface the problem. The most common source is content pasted from websites or exported from Word's HTML Save As.

How to fix it

  1. Run EPUBCheck or use Calibre's Check Book (Edit Book → Tools → Check Book) to get a list of RSC-005 errors with file names and line numbers.
  2. Open each flagged chapter file and fix void element syntax: <br><br/>, <img ...><img .../>, <hr><hr/>.
  3. Fix improperly nested elements: a <p> tag containing a block-level element like <div> violates XHTML nesting rules — restructure the markup so they are siblings, not nested.
  4. Check for unquoted attributes: <img src=cover.jpg><img src="cover.jpg"/>.
  5. Re-run EPUBCheck after fixing all files and confirm no RSC-005 parse errors from malformed elements remain.

Common questions

My EPUB opened fine in Calibre — why does Apple Books still reject it?

Calibre's viewer renders permissively, treating EPUB content as HTML in some versions. Apple Books runs a strict XML parser against each chapter file. A file that displays correctly in Calibre and passes a basic EPUBCheck run can still fail Apple's stricter chapter-level HTML validation.

How did unclosed tags get into my EPUB?

The most common sources: (1) copying formatted text from a website using HTML5-style void elements without self-closing slashes, (2) Word's 'Save as Web Page' export, which outputs HTML rather than XHTML, and (3) older conversion tools that generate HTML4-compatible output.

Check your EPUB before uploading

The free EPUB Validator catches structure, metadata, and navigation errors — no signup, no Java, runs in the browser.

Validate Your EPUB Free →

Building your EPUB correctly from the start prevents most of these errors before they happen. See the EPUB formatting guide for the full workflow: manuscript cleanup, TOC, front matter, EPUB 3.0 generation, and validation.

Platform rejection guides: Why Apple Books rejects ebooks

Publishing checklists: Apple Books submission checklist