How to convert line breaks to <br> tags
- Paste your text into Input.
- A
<br>tag is added at every line break. Change it under Custom, for example to<br />\nfor XHTML. - Copy the HTML into your page, template or email.
<br> or paragraphs?
Use <br> for line breaks that belong inside one block of text, like the lines of an address, a poem or a signature. For separate paragraphs of prose, <p> tags are better because they add spacing and help screen readers.
Same as PHP’s nl2br
PHP has a built-in function, nl2br(), that does exactly this. This page gives you the same result without writing code, which is handy for one-off edits in a CMS or an HTML email.