Text to HTML
Automatically wrap plain text into valid HTML paragraphs and breaks
Prepare plain text for a web page
Pasting raw text into an HTML file rarely works. Line breaks collapse into spaces, and characters like ampersands and angle brackets can be misread as markup. Text to HTML handles those basics. It escapes the characters that have special meaning in HTML and, if you want, adds paragraph and line-break tags so your text keeps its shape in a browser. It does not try to detect headings, lists or links, so it suits straightforward prose.
Converting your text
- Type or paste your text into the Source Text editor, which shows line numbers. Load Sample inserts a short example and Paste pulls from the clipboard.
- Choose your options below the editor: Wrap in <p> tags and Convert newlines to <br>. Both are ticked by default.
- Click Convert to HTML.
- Read the result in the Generated HTML Code panel, then use Copy or Download, which saves a file named converted.html.
What each step does to your text
First, the characters &, <, >, double quotes and single quotes are replaced with their HTML entities, so the text will display literally rather than being treated as tags. Then, if the line-break option is on, every newline becomes a br tag followed by a newline. Finally, if the paragraph option is on, the text is split at blank lines and each chunk is wrapped in a p element, with leading and trailing spaces trimmed. The header counter shows how many lines your source has.
Choosing the right combination
- Want separate paragraphs? Untick the line-break option. With both boxes ticked, blank lines are converted to br tags before paragraphs are split, so you will typically get one paragraph containing several br tags rather than distinct paragraphs.
- Want line breaks preserved exactly, as in an address or poem? Tick only the line-break option.
- Want escaped text with no added tags? Untick both.
Everyday uses
- Turning an email or a document draft into markup for a CMS field that accepts HTML.
- Preparing a plain-text product description for an e-commerce listing.
- Making a code sample or message safe to embed in a page, since angle brackets are escaped.
- Building the body of an HTML email from a text draft before adding your own styling.
Limits
The result is a fragment, not a full page: there is no doctype, head or body. Multiple spaces are not preserved in a browser and links are not turned into anchors. Because the tool escapes everything, text that already contains HTML will show up as literal tags, so use it on plain text only. Conversion is done in your browser with JavaScript.
Related Tools
Related Tools