VOOZH about

URL: https://www.geeksforgeeks.org/html/where-to-use-br-br-and-br/

⇱ Where to use <br>, <br/> and <br /> ? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Where to use <br>, <br/> and <br /> ?

Last Updated : 23 Jul, 2025

The <br> tag in HTML is used to break the line. In HTML, <br> is preferred, but we can use <br/> and <br /> as well. <br> is an empty tag, so we don't need to close this tag. We can use either <br> or </br> to break line, both are allowed (but not both(<br> </br>) because it will give us two-line break). In XHTML, <br /> is preferred, but we can use <br/> or <br></br> since XML doesn't allow leaving tags open.. The outdated browsers parse XHTML as HTML and failed with <br/>.

Note: XHTML is case-sensitive and HTML is not.

How do I use <br>: we can just place <br> whatever position we want a line break.

Output:

👁 Image

As we can see from the above code the <br> tag breaking the line and the next statement printing in a new line.

How do I use </br>: we can just place </br> whatever position we want a line break same as <br> tag.

Output:

👁 Image

As we can see from the above code it is giving the same output as <br> tag giving.

Conclusion: The <br> and </br> tag can be used alternatively but if we use both together then we will get two line breaks, one for <br> and other for </br>.

Example 1: Using both <br> and </br> (It gives two line breaks)

Output:

👁 Image

Example 2: <br/> Used to break line in XHTML.

Output:

👁 Image

Example 3

Output:

👁 Image
Comment