Skip to main content
HTML Validation

Bad value for attribute “src” on element “img”: Fragment is not allowed for data: URIs according to RFC 2397.

About This HTML Issue

A fragment identifier (the part after #) is not allowed in a data: URL used in an img src.

The img element accepts any valid URL in the src attribute, including data URLs per RFC 2397. However, RFC 2397 forbids fragment identifiers in data: URIs.

If you need to reference an internal fragment (e.g., an SVG symbol or id), use one of these approaches:

  • Inline the SVG in the DOM and reference its ids normally.
  • Put the SVG in a separate file and use a standard URL with a fragment (example.svg#icon).
  • Remove the fragment from the data: URL and ensure the content renders without fragment navigation.

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Last reviewed: August 21, 2025

Was this guide helpful?

Ready to validate your sites?
Start your free trial today.