Skip to main content
HTML Validation

Bad value X for attribute “src” on element “img”: Illegal character in path segment.

About This HTML Issue

The src attribute on an element <img> contains a character which is not allowed unless properly encoded.

Special characters needing encoding are: :, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ;, =, as well as % itself.

For example, this image tag is incorrect because the src attribute contains an the unallowed characters [ and ]:

<img src="image[00].svg" alt="logo">

Instead, this is the properly percent-encoded src attribute, where [ has been replaced with %5B and ] with %5D.

<img src="image%5B00%5D.svg" alt="logo">

Learn more:

Last reviewed: March 08, 2023

Was this guide helpful?

Find issues like this automatically

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

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