Fixing the “element ‘img’ missing required attribute ‘alt'” EPUB Error
The error: element “img” missing required attribute “alt”
Why This Happens
Every image in a valid EPUB file needs an alt attribute — a short text description that displays if the image fails to load, and that screen readers announce to visually impaired readers. If an image was inserted without one (common when images are pasted directly into Word rather than added with alt text specified), this error appears during validation.
Option 1: Add Alt Text Directly in Word
- Open your document in Word.
- Click on the image.
- Right-click and select Format Picture (or Edit Alt Text, depending on your Word version).
- Type a description of the image into the Alt Text field. It doesn’t need to be elaborate — a simple, accurate description works.
- Repeat for every image in the document.
- Recreate the HTML document and continue creating your EPUB file as normal.
Option 2: Fix It Directly in the HTML
- Open your document in Word.
- Go to Save As, and choose **Web Page, Filtered (.htm, .html) as the file type.
- Close the document in Word.
- Open the saved HTML file in a plain text editor (Notepad on Windows, TextEdit in plain-text mode on Mac).
- Use Find and Replace to search for jpg
- Replace it with jpg” alt=”XXXXX” — note the equals sign, which is required for valid HTML (alt=”XXXXX”, not alt “XXXXX”).
- Use Replace All so every instance is caught at once.
A Better Long-Term Fix
Using a placeholder like “XXXXX” will clear the validation error, but it isn’t meaningful alt text — it won’t actually describe the image to a screen reader user. Once you’ve cleared the immediate error, it’s worth going back through and replacing each placeholder with a real, brief description of that specific image. See our full guide to accessible eBook formatting for more on why this matters beyond just passing validation.
Skip the Manual Fixes
If you’d rather not hunt through raw HTML for missing attributes, we format manuscripts to be clean, accessible, and validation-error-free from the start.
See our other resources covering ePub errors.
