The Self-Closing Slash
parser and markup 2000 partlySouvenir of the years the web tried to become XML.
In 2026: Partly, as pure decoration: in HTML the trailing slash on br or img does exactly nothing, the parser discards it, and the demo proves the tags behave identically with and without. XHTML was the real thing: served as application/xhtml+xml, one unescaped ampersand replaced your whole page with a parse error, the Yellow Screen of Death. Almost everyone served XHTML as plain HTML instead, which made it HTML with extra slashes. HTML5 ended the argument and kept the slash as a shrug.
Where it came from: XHTML 1.0, W3C, 2000. Ian Hickson's Sending XHTML as text/html Considered Harmful, 2002, said the quiet part; HTML5 kept the slash as an ignorable shrug.
Hixie, 2002 ↗Wikipedia XHTML ↗
<p>Line one<br />Line two<br>Line three</p>
<script>
document.write("<p style='font:13px Verdana'>Both BR tags above broke the line " +
"identically. document.querySelectorAll('br').length is <b>" +
document.querySelectorAll("br").length + "</b>: the slash added nothing.</p>");
</script>
<p style="font:13px Verdana">Served as real XHTML, one bad character produced a
full page parse error instead of a page. Nobody misses it.</p>