Dev TooloraLocal dev tools

> Text

HTML to Plain Text

Turn HTML into readable plain text locally: paragraphs, lists and tables keep their shape, while scripts, styles and tags disappear.

Runs locallyWorks offline
Back to results
Input

Source data

Links
Output

Result

Your result will appear here.

Tool guide

About this tool.

HTML to Plain Text reads markup the way a browser reads it, including end tags that HTML lets you leave out, such as a missing </li> or </p>. It then writes only what a reader would see. Tags, comments and the doctype disappear, and so do the contents of head, script, style, template and svg.

Entities are decoded, so &lt; becomes < and &amp; becomes &. Runs of spaces, tabs and line breaks collapse to one space, as they do on screen. A no-break space (&nbsp;) is kept as a no-break space.

Paragraphs, headings, block quotes, lists, tables, figures, pre blocks and horizontal rules are separated by a blank line. Other block elements such as div get a single line break, and so does br. A horizontal rule becomes ---.

List items start with - or with a number. An ordered list honors its start attribute. Each nested list is indented by 2 more spaces. Table rows go on separate lines, and their cells are separated by tabs. A block element inside a table cell becomes a space. Images become their alt text. Text in pre and textarea keeps its inner spacing and line breaks, but trailing spaces on each line are trimmed.

Paste HTML as the main input, or select it in the editor.

Choose how links are written: Text only, or Text and URL.

Run the tool. Block elements become line breaks and blank lines, and inline tags such as b and span disappear.

Copy the result, replace the selection with it, or save it as text.txt.

  • <p>Hello <b>world</b></p> → Hello world
  • <ul><li>One<li>Two</ul> → - One and - Two on separate lines
  • <ol start="3"><li>a</li></ol> → 3. a
  • <a href="https://x.dev">docs</a> with Text and URL → docs (https://x.dev)
  • <p>a&nbsp;&lt;b&gt;</p> → a, a no-break space and <b>

  • Processing is local; nothing is uploaded.
  • Limits: 5,000,000 UTF-16 units of input, 100,000 nodes and 100 nesting levels.
  • Output lines have no trailing spaces, and the text ends with one line break.
  • CSS is not applied, so elements hidden with display: none still appear in the text.

FAQ

Questions about HTML to Plain Text

How do I keep link addresses?

Choose Text and URL. A link is then written as its text followed by the address in parentheses. Links to an anchor on the same page (#...) and links whose text is already the address are written once.

Does script or style code end up in the text?

No. Script, style, template and svg contents are dropped, and so is the head with its title. Comments and the doctype are removed too.

Why is the spacing kept in some places?

Spaces only collapse where a browser would collapse them. Text inside pre and textarea keeps its inner spaces and line breaks, except that trailing spaces on each line are trimmed. Only the first line break right after the opening tag is dropped, as in HTML.

What happens with broken or unclosed HTML?

Elements left open are closed the way a browser would close them, and the text is written as usual. Elements whose end tag is optional, such as li, p and td, close silently.

Continue with

HTML Formatter & MinifierFormat or minify HTML locally. Block elements are indented, and pre, textarea, script and style content is kept byte for byte.HTML EntitiesEscape HTML syntax characters or decode named, decimal and hexadecimal character references as plain text.Markdown to HTMLConvert Markdown into real HTML with a local visual preview, explicit syntax options and exact file export.