YourTools.
简体中文
Back to the catalog
Tools

HTML tag filter

Strip HTML tags to get readable text, or keep the tags and remove their attributes; chosen tags or attributes can stay. Scripts never run.

Process locally

Files stay in this browser session. Closing or clearing releases them.

Add text

Type or paste the text to process

Adjust settings

Optional: Remove, Keep these tags or attributes, Remove empty lines and more

HTML tag filter

Run

Processes in this browser; cancel at any time

Add text first

About this tool

Remove HTML tags to get the readable text of a web page, an email template or content copied from an editor. Or keep the tags and strip their attributes to clean up markup full of class and style attributes. In both modes you can name tags or attributes that should stay, such as links or images.

When extracting text, headings, paragraphs and list items start new lines, table cells are separated by tabs, and the contents of script and style elements are dropped. The HTML is only read as text, so scripts never run and nothing is fetched. Up to 1 MB is processed in your browser and is not uploaded.

How to use it

  1. Paste the HTML source, or select “Use example”.
  2. Under “Remove”, choose “Tags (get text)” or “Attributes (keep tags)”.
  3. In “Keep these tags or attributes”, list any to keep, separated by commas, such as a, strong or href, src. Leave “Remove empty lines” and “Trim spaces at line ends” on for tidier output.
  4. Select “Run”, then preview the result and download it: plain text as a text file, or an HTML file when tags remain.

Formats and limits

Input
Text
Output
Plain text, HTML
Size limit
1 MB
Settings
Remove (Tags, Attributes); Keep these tags or attributes; Remove empty lines; Trim spaces at line ends
Privacy
Files stay in the current browser session. No file bytes are uploaded.
Price
Free, no sign-up

Common questions

How do I keep links or bold text?

In “Tags (get text)” mode, list the tags in “Keep these tags or attributes”, such as a, strong. Kept tags are written back with all their attributes, the text around them stays HTML-escaped, and the result is saved as an HTML file.

What does “Attributes (keep tags)” do?

It keeps every tag, comment and piece of text and removes all attributes except the ones you list. Keeping href and src, for example, leaves links and images working while class, style and id go. Script and style elements stay too, only without their attributes.

What happens to scripts, styles and other hidden content?

When extracting text, everything inside script, style, noscript, template, iframe, object, svg and math elements is dropped, so CSS and code do not end up in the text. The tool only reads the HTML, so no script runs and no image or link is loaded.

Why are entities like & turned into characters?

When extracting text without keeping any tags, entities are decoded, so &amp; becomes & and &lt; becomes <. When you keep tags, the result is HTML, so the text stays escaped.

How is the extracted text laid out?

Block elements such as p, div, h1 to h6, li and tr start a new line, br becomes a line break and table cells are separated by tabs. Runs of spaces are collapsed except inside pre, and at most one blank line is kept between blocks, or none with “Remove empty lines” on.