Convert line breaks to <br> tags

Turn line breaks into HTML <br> tags.

Replace with

0 lines · 0 characters

0 lines · 0 characters

Results update as you type.

Runs in your browser. Nothing uploaded.

How to convert line breaks to <br> tags

  1. Paste your text into Input.
  2. A <br> tag is added at every line break. Change it under Custom, for example to <br />\n for XHTML.
  3. 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.