gizmobench
BrowseDaily

Convert a TXT File to HTML

Open a UTF-8 .txt file from your computer, review the generated markup, and choose Download HTML. This page starts in Paragraphs; Line breaks, List and Numbered list are available for other source structures. The download contains a UTF-8 declaration and a body holding the generated fragment. Your file stays in the browser, and plain source characters are escaped before structural tags are added.

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>, <ol>, <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. Copy takes the fragment shown in the pane; Download HTML wraps it in a standalone page with a UTF-8 declaration. Local files must be UTF-8 plain text; Word, PDF and rich-text document layouts are not imported. There is no fixed input-size limit; the practical limit is this browser’s memory.

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 a Notepad text file to HTML?
Save the Notepad document as UTF-8, select it with Open a UTF-8 text file, and review the paragraph or list output. Download HTML saves converted-text.html, which you can open in a browser or edit as source. The converter does not change Windows file associations or the original file.
Is this the same as changing .txt to .html?
No. Renaming a file leaves its bytes unchanged. This converter escapes literal text and adds paragraph, br or list markup. If your TXT file already contains authored HTML that you want rendered unchanged, rename or save it in your source editor, or use HTML Viewer to inspect and download that original source.
Can I convert Word, PDF or a folder of text files?
This opens one UTF-8 plain-text file at a time. It does not import DOCX, PDF, RTF, images, non-UTF-8 encodings or a folder, and does not retain rich document layout. Export the words as UTF-8 TXT first when that is the result you need.

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.