Newline to BR Converter — Free Online Tool

Convert plain-text line breaks into HTML <br> tags (nl2br), with an optional XHTML self-closing mode and a reverse br-to-newline mode. Newline to BR Converter is a free online tool from the ToolsRift HTML Tools collection. It runs entirely in your browser — nothing to install, no signup, and your data never leaves your device.

Loading Newline to BR Converter

How to use Newline to BR Converter

  1. Open the Newline to BR Converter above — it loads instantly, no account needed.
  2. Enter or upload your input. Everything is processed locally on your device.
  3. Get your result immediately and copy or download it with one click.

Frequently asked questions

What does nl2br do?

It replaces every newline character (\n, \r or \r\n) in your text with an HTML <br> tag so line breaks survive when the text is rendered inside HTML, mirroring PHP's nl2br() function.

What is XHTML mode?

XHTML and self-closing HTML require void elements to be closed, so XHTML mode outputs <br /> with a trailing slash instead of <br>. Standard HTML5 accepts either form.

Can it convert <br> back to newlines?

Yes, switch to reverse mode to turn <br>, <br/> and <br /> tags back into plain newline characters, which is handy when cleaning HTML into editable plain text.

More HTML Tools

Text/SVG to Data URI
Encode text, SVG or CSS into a base64 or URL-encoded data URI you can embed inline in HTML or CSS with no external file
Meta Tag Generator
Generate complete SEO meta tags including title, description, Open Graph, and Twitter Cards
Open Graph Generator
Generate Open Graph and Twitter Card meta tags for social media sharing optimization
HTML Table Generator
Generate semantic HTML tables from rows and columns input with customizable styling
HTML List Generator
Generate ordered or unordered HTML lists from text input with proper markup structure
HTML Color Code Generator
Generate HTML color code snippets in hex, RGB, RGBA, and HSL formats with examples

← View all HTML Tools