Skip to content
UniKit

Newlines to <br> tags

Turn plain-text line breaks into HTML <br> tags: CRLF/LF/CR supported, optional escaping of & < > and quotes first, all local.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Multi-line text

Off by default so the output matches the input character for character (useful when the input already is an HTML fragment); when on, text is escaped before line breaks are replaced, making <br> the only new tag and the result safe to embed.

HTML fragment

CRLF, LF and CR all count as one line break and are replaced by <br> (no <p> wrapping, no container tag added).

Enter multi-line text to get an HTML fragment with <br> tags

Line breaks: 0 · Lines: 0

What this tool does

  • Turn the line breaks of chat logs, lyrics or comments into <br> so they can be pasted into HTML email, templates or a CMS rich-text field.
  • Embed user-submitted plain text safely: switch escaping on and & < > " ' become entities, leaving <br> as the only tag in the result.
  • Verify the break count: the line-break and line statistics below the result match the input exactly, with CRLF and CR counted as one break.

Example

Input

first line
second line

Output

first line<br>second line

Line breaks: 1, lines: 2. Escaping is off by default so the output mirrors the input; with escaping on, <b> is written as &lt;b&gt;.

Frequently asked questions

Why is HTML escaping off by default?

Because many use cases start from HTML fragments (template assembly, email bodies, CMS fields) where escaping would turn the fragment into plain text. Leaving it off keeps the rule simple: the output is the input with line breaks replaced by <br>. Turn escaping on when the content must be embedded into a page safely.

Does it add <p> or any container tag?

No. It only replaces line breaks with <br>. Consecutive blank lines produce consecutive <br> tags rather than a paragraph, so use a Markdown renderer or hand-written <p> tags when you need block-level structure.

Does CRLF become two <br> tags?

No. CRLF (\r\n), LF (\n) and CR (\r) each count as a single line break, so Windows and Unix text produce identical results and the break counter only counts once.

Why does &amp; turn into &amp;amp;?

Escaping is character by character and handles & first, so entities already present in the input (&amp;) get escaped again. That is the safe, predictable behaviour; if your input is already escaped HTML, leave the switch off.

Keywords:nl2brline break to br

Related tools