Open In App

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

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
1 Likes
Like
Report

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.

HTML
<!DOCTYPE html>
<html>

<head>
    <title>
        br example
    </title>
</head>

<body>

    
<p> Hi My name is Kapil. <br> I am 23 year old.</p>



</body>

</html>

Output:

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.

HTML
<!DOCTYPE html>
<html>

<head>
    <title>
        br example
    </title>
</head>

<body>

    
<p> Hi My name is Kapil. </br> I am 23 year old.</p>



</body>

</html>

Output:

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)

HTML
<!DOCTYPE html>
<html>

<head>
    <title>
        br example
    </title>
</head>

<body>

    
<p> Hi My name is Kapil. <br></br> I am 23 year old.</p>



</body>

</html>

Output:

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

HTML
<!DOCTYPE html>
<html>
<head>
    <title>
        br example
    </title>
</head>
<body>


<p> Hi My name is Kapil. <br/> I am 23 year old.</p>
 


</body>
</html>

Output:

Example 3

HTML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" 
      xml:lang="en" 
      lang="en">

<body>
    
<p> This is Example of using &lt;br /&gt; tag. <br />
        This text will come in new line.</p>

</body>

</html>

Output:


Explore