Back in the day, I remember writing many a webpage without using / in the
tag. What changed? Also, is the space "required?"

  • 1
    Just copy Wikipedia for now. They do know what is best. And for best compatibility always have a space before the /.
    – unixman83
    Mar 23, 2012 at 9:04

6 Answers 6


I remember writing many a webpage without using / in the tag.

I have great news for you! You don't need no steenking / any longer. Again, I mean.


Because ...

What changed?

XHTML, an implementation HTML serialized as XML. XML has a very strict set of syntax requirements. One of those requirements is that you can't leave a tag open. The syntax <tag/> is called a self-closing tag, in that it opens itself and closes itself at once.

Also, is the space "required?"

One of the more interesting things about XHTML is that it's kind of backwards compatible with HTML. You can throw a legal XHTML document at an HTML parser and it should be able to make sense out of it. However, not all HTML parsers can do so. Old, old, prehistoric, no-longer-used versions of Netscape and other browsers would see the self-closed <br/> tag not as a br, but as a tag named br/, which is bogus. Putting a space before the forward slash became best practice.

There's a fatal flaw with XHTML. Because it requires the XML parsing rules, that also means it requires the XML error handling rules, which mandate that parsing halt immediately upon a syntax error. In other words, if there's a single parse error in the document, the browser must not show the document to the user.

That's kind of a show-stopper. XHTML served as XML never caught on because some browser vendors (like Microsoft) refused to add support due to the must-die-immediately nature of error handling.

XHTML still caught on because it was full of awesome best practices, even if the documents didn't end up being served as XML.

Now, earlier I said that you don't need it any longer. That is true for both HTML4 and the upcoming HTML5. They've gone through the effort of actually specifying how HTML5 should be parsed now, and that forward slash is going to be considered an error. Thankfully XHTML5 is a thing, and if you really want to use the XML syntax rules instead of the HTML5 syntax rules, you can go right ahead.


It's required for XHTML compliance:

Broadly, the XML rules require that all elements be closed, either by a separate closing tag or using self closing syntax (e.g. br /), while HTML syntax permits some elements to be unclosed because either they are always empty (e.g. input) or their end can be determined implicitly ("omissibility", e.g. p).

Read the section under the heading: "Relationship to HTML" for more info.

  • For the differences between HTML and XHTML see wiki.whatwg.org/wiki/HTML_vs._XHTML#Syntax_and_Parsing
    – feeela
    Jul 21, 2011 at 21:15
  • Remember though. We are coding to flaky implementations (web browsers). not to an XML standard. On the web the implementation is everything.
    – unixman83
    Mar 23, 2012 at 9:07
  • @Unixman83 - Does your comment somehow make my answer wrong, that it's required for XHTML compliance and that's the reason the close tag was added to all elements in HTML? That's a questionable reason to downvote an answer.
    – JMC
    Mar 23, 2012 at 14:53

<br/> is used on pages with XHTML Doctype. The reason was that XHTML was based on XML and XML required all tags to have a closing tag.


<tag> </tag>

In the case where there was no closing tag (like single tags as <br>) XHTML requires the "/" for standard compliance.

As for the space: It is not required.

And when it comes to what changed. It is all about HTML itself. As HTML 5 gains more popularity every day people are using

In HTML 5 <br> is used. Also <BR> is acceptable too .


<br/> Tag doesn't required space but it is necessary for some old browser to render tags correctly.The appropriate way to do is without extra space as this is something XHTML inherited from XML.

But Appropriate way is <br /> because:

Text and XML editors that highlight XML syntax in different colours will highlight properly with <br /> but this is not always the case if you use

<br /> is backwards-compatible with XHTML and well-formed HTML (ie: XHTML) is often easier to validate for errors and debug

Some old parsers and some coding specs require the space before the closing slash (ie: <br /> instead of <br/>) such as the WordPress Plugin Coding


As has been said, the trailing slash is used to close empty elements (e.g. br, hr, img), and is required when writing pages using the XHTML doctype. The space is not required, but was commonly used since some older browsers (I think including Netscape 4) did not like empty elements having a trailing slash without the space. So the space became common use to accommodate the browsers that didn't fully understand XHTML. It's not required now.


<br /> is still the most compatible tag form across all current browsers and doctypes. That's why you'll still see it used on sites like Wikipedia. Don't ask me why, ask Microsoft, Mozilla, Netscape, Opera, and the other browser vendors why their tag support is so bizarre.

<br /> is the most compatible because some mobile browsers require a closing tag whereas older desktop browsers fail on closing tags, hence the extra space as a compromise.

  • 2
    How is it more compatible? All browsers have supported <br> from the beginning, before XHTML came about, so <br> is arguably more compatible. Mar 23, 2012 at 10:31
  • @DisgruntledGoat Updated answer
    – unixman83
    Mar 24, 2012 at 5:54
  • 1
    you missed my point - I'm talking about <br> not <br/> or <br />. The former is more compatible because all browsers right back to the ancient ones support it, whereas the latter two work in all modern browsers and most older browsers, but not necessarily all. Mar 26, 2012 at 19:42
  • @DisgruntledGoat That's not what I've heard. Some mobile browsers will choke on tags that aren't somewhat XHTML compliant. Such as bare <br> but only when you set the doctype.
    – unixman83
    Mar 26, 2012 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.