HTML Tag Stripper
Remove lexical HTML tags, comments, and declarations while retaining raw text and character references; the result is not sanitized markup.
Description
Removing lexical HTML tags yields concatenated source text tokens.
When to use HTML Tag Stripper
Use this tool to remove lexical HTML tags, comments, and declarations while retaining raw text and character references; the result is not sanitized markup.
Paste the HTML source to transform. Compare the returned source or text with the input using the lexical rules below.
How to use HTML Tag Stripper and understand its results
- Paste the HTML source to transform. Compare the returned source or text with the input using the lexical rules below.
- Enter html using the field table and calculation rules, then run the tool.
- Read text. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| html | HTML source. | string; maximum length: 1000000 | Required |
Paste HTML source. The shared scanner distinguishes tags, comments, declarations and raw-text elements; keep only text tokens in source order. Return their direct concatenation without inserting spaces or decoding entities. Script/style contents are retained.3, 4
text=join(all text-token raw strings, empty separator) Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| text | Text left after removing lexical markup. | string; maximum length: 1000000 |
{
"input": {
"html": "<p>Hello <b>world</b> & friends</p>"
},
"output": {
"text": "Hello world & friends"
}
} Limitations and assumptions
The scanner is not a browser DOM parser. This result is not sanitized markup: malformed tags and literal markup inside raw-text elements can remain, so handle it as text.
Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use HTML Whitespace Collapser: Collapse ASCII whitespace in lexical text nodes while preserving tags, attributes, comments, and preformatted or raw-text element contents. For a complementary task, use HTML Comment Remover: Remove lexical HTML comments while preserving comment-like text inside script, style, title, and textarea elements.
Further background: HTML Standard: Tokenization.
References
-
HTML Tag Stripper — tool.io
-
HTML Standard: Tokenization — WHATWG
-
HTML Tag Counter — tool.io
-
HTML Attribute Parser — tool.io
Similar or alternative tools
- HTML Whitespace Collapser
Collapse ASCII whitespace in lexical text nodes while preserving tags, attributes, comments, and preformatted or raw-text element contents.
- HTML Comment Remover
Remove lexical HTML comments while preserving comment-like text inside script, style, title, and textarea elements.