gizmobench

Text to HTML

Type or paste on the left and the markup you can paste into a page appears on the right. What is different here is the order the work happens in: every character of your text is escaped first, and only then are the tags added around it, so a script tag you paste comes out as text and there is no point in the conversion where your angle bracket and the tool's angle bracket mean the same thing. A blank line starts a new p element and one blank line or five make the same boundary; a single line break inside a block becomes a br tag, or stays a plain newline if you would rather the browser read it as a space; list mode gives one li per line inside a single ul. Auto-linking is off until you switch it on, and then it builds anchors only for http, https and mailto addresses, so a javascript: or data: address stays the text it was. The html pane is a preview of the markup printed as characters: this page never renders what you paste.

Mode
Paragraphs
2
Links
off
Line breaks

A blank line starts a new p element, and a single line break inside it becomes a br tag. Auto-linking is off, so a web address stays as the text you typed.

  • Angle brackets in the texta tag typed as text
    <p>Read the &lt;script&gt; note first.</p>
  • A blank linetwo blocks
    <p>One paragraph.</p> <p>And a second one.</p>
  • A javascript: URLauto-link on
    <p>Open javascript:alert(1) or <a href="https://example.com">https://example.com</a></p>

The html pane is a preview of the markup, printed as characters: this page never renders what you paste, so a tag in your text cannot do anything here. The only tags this tool writes are <p>, <br>, <ul>, <li> and <a href="...">, with no class, no style and no other attribute, so the markup takes the styling of the page you paste it into. Everything else that arrives is your text, escaped. The box takes up to 1,000,000 bytes of UTF-8 in one go, and text past that is refused with both numbers rather than quietly shortened.

Accuracy. Every character is escaped before any markup is added, so nothing you paste can become a tag or an attribute. Auto-linking is off until you switch it on and then only ever builds http, https and mailto links. The conversion and the preview both run in your browser.

Common questions

How do I convert plain text into HTML paragraphs?
Paste the text into the left box and the markup appears on the right, ready to copy. In the default mode a blank line starts a new p element, so the paragraphs you already typed are the paragraphs you get, and a run of several blank lines is the same single boundary rather than a string of empty p elements. A single line break inside a paragraph becomes a br tag, and the br and space buttons in the readout switch that: br writes the tag, space leaves the line break as a newline in the markup, which a browser renders as a single space. Line-break mode drops the p element and ends every line with a br tag instead, and list mode writes one li per line inside one ul. The readout counts what came out, so you can check the number of paragraphs, lines or items against the text you started with.
What happens to a less-than sign, an ampersand or a quote in my text?
Five characters are rewritten before any markup exists: & becomes &amp;, < becomes &lt;, > becomes &gt;, the double quote becomes &quot; and the apostrophe becomes &#39;. That is what makes the output safe to paste into a page: a tag you typed arrives as the characters of a tag rather than as a tag, and an ampersand in a sentence cannot start an entity by accident. The apostrophe is written as a number rather than as the &apos; name because an older parser prints that name as text instead of an apostrophe. The escaping is one pass and it never runs twice, so text that arrived already escaped keeps exactly one more layer and nothing is lost on the way back.
Does it turn web addresses into links?
Only when you switch auto-linking on, and then only for addresses it is willing to write. The tool links an http or https address, a mailto address, a bare www address, which is given an https scheme, and a bare email address, which is given a mailto scheme. Everything else stays as text, including javascript, data, vbscript, file, ftp and tel addresses, because the rule is an allow list rather than a list of dangerous schemes to avoid, and the finished address is checked a second time before an anchor is written. Sentence punctuation is left outside the link, so a full stop at the end of a sentence is not part of the address, and a closing bracket is kept only when the address opened one. The anchor is written with a href and nothing else: no class, no target and no rel, so it takes the styling of the page you paste it into.
Why does my bulleted list lose its dashes?
Because in list mode the ul carries the bullet, so repeating it inside the item text would print two. A leading dash, asterisk, bullet character, en dash, or a number written as 1. or 1), is left out of the item text, and the line under the readout says how many lines that happened to, so it is never a silent edit. A line that is only a marker keeps its text rather than becoming an empty item, and markers are left alone in the other two modes: in paragraph mode a line that starts with a dash keeps it.
Is there a size limit, and is my text sent anywhere?
The conversion runs in your browser, so there is no server in this, no account and nothing logged. One conversion takes up to 1,000,000 bytes of UTF-8, and text past that is refused with its own size and the limit in the message rather than quietly shortened, which means a result you can see is always the whole of what you pasted. The text itself is never written to storage or sent anywhere. The three settings are remembered in this browser so the tool opens the way you left it, and the Start over button above the tool forgets them.
Can I get a numbered list instead of a bulleted one?
Not from the mode buttons: list mode writes one ul with an li for every line, and that is the markup you copy. Changing it to an ordered list is a one-character edit at each end of what you copied, the u of ul becoming an o in the first line and in the last, because the li elements between them are the same either way. The numbers you typed are left out of the item text in list mode, so a list pasted as 1., 2., 3. becomes items a numbered list will number itself.
What happens to Windows line endings and invisible characters?
Carriage returns are normalised before anything else, so a paste from a Windows editor has the same paragraphs as a paste from anywhere else, and no carriage return reaches the markup. Control characters that HTML has no way to carry are left out and counted, with the count printed under the tool, and tabs and line feeds are not touched. Text holding half of a character, which is what a broken copy and paste leaves behind, is refused with the position of that half rather than converted into markup with a hole in it.

Every character is escaped before any markup is added, so nothing you paste can become a tag or an attribute. Auto-linking is off until you switch it on and then only ever builds http, https and mailto links. The conversion and the preview both run in your browser.