Skip to main content
HTML Validation

A slash was not immediately followed by “>”.

About This HTML Issue

The HTML parser expects a slash inside a tag to signal the end of a self-closing (void) element, such as <br /> or <img />. When the parser encounters a / that isn’t immediately followed by >, it can’t interpret the tag correctly and raises this error. This can happen in several scenarios:

  • A typo in an attribute name or value, such as accidentally typing a / instead of another character.
  • An unquoted attribute value that contains a slash, like a URL path.
  • A misplaced slash somewhere in the middle of a tag.

While browsers are generally forgiving and may still render the page, relying on error recovery leads to unpredictable behavior across different browsers. Fixing these issues ensures your markup is unambiguous, standards-compliant, and easier to maintain.

Examples

Stray slash in a tag (typo)

A common typo where a slash appears between attributes:

<!-- ❌ Slash not immediately followed by ">" -->

<input type="text" / name="username">

Remove the stray slash:

<!-- ✅ Correct -->

<input type="text" name="username">

Unquoted attribute value containing a slash

If an attribute value contains a / and isn’t wrapped in quotes, the parser sees the slash as part of the tag syntax rather than the value:

<!-- ❌ Unquoted value with slash confuses the parser -->

<img src=images/photo.jpg alt="Photo">

Always quote attribute values, especially those containing slashes:

<!-- ✅ Correct: quoted attribute value -->

<img src="images/photo.jpg" alt="Photo">

Slash in the wrong position for self-closing tags

Placing the slash before the final attribute instead of at the end of the tag:

<!-- ❌ Slash is not immediately before ">" -->

<img src="logo.png" / alt="Logo">

Move the self-closing slash to the very end, or simply remove it (self-closing syntax is optional in HTML5 for void elements):

<!-- ✅ Correct: slash at the end -->

<img src="logo.png" alt="Logo" />

<!-- ✅ Also correct: no self-closing slash needed in HTML -->

<img src="logo.png" alt="Logo">

Accidental double slash

Sometimes a self-closing tag ends up with an extra slash:

<!-- ❌ Double slash before ">" -->

<br //>

Use a single slash or omit it entirely:

<!-- ✅ Correct -->

<br />

<!-- ✅ Also correct -->

<br>

Find issues like this automatically

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

Help us improve our guides

Was this guide helpful?

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