Strip HTML Tags Tool

Paste HTML to remove every tag and get clean plain text.

How it is calculated

The tool works in these steps. First it deletes <script> and <style> blocks together with everything inside them. Next, <br> and block tags such as <p>, <div>, headings and list items become line breaks, and table cells become a space, so neighbouring words stay apart. All remaining tags are removed without adding anything, so text touching an inline tag like <span> stays joined. Then HTML entities are decoded: &amp; becomes & and &nbsp; becomes a non-breaking space character. Finally runs of spaces and tabs shrink to one space, blank space around line breaks and at both ends is trimmed, and the characters of the result are counted. Entities are decoded last, so an escaped tag such as &lt;b&gt; survives as visible text.

Worked example

Input: <p>Save <b>20%</b> on <i>all</i> shoes today</p>. The tool drops the six tags <p>, <b>, </b>, <i>, </i> and </p>, leaving the text between them in order. Result: Save 20% on all shoes today. Character count: 27, counting letters, digits, the percent sign and the spaces.

Try this example →

Common mistakes

  • Expecting inline tags to add a space. <span>a</span><span>b</span> becomes ab; only block tags, <br> and table cells separate text, so add the spaces yourself if words must stay apart.
  • Pasting content that was already escaped (such as &lt;b&gt;) and expecting it to be removed. Escaped tags are decoded after stripping and come back as literal <b> text.
  • Using the output as a security filter for untrusted input. It cleans text for reading, but a decoded &lt;script&gt; reappears as text, so it must still be escaped before it is shown on a page.
  • Comparing the character count with a word-processor count. Here it counts characters after decoding and trimming, so &amp; counts as one character and a &nbsp; as one character that is not a normal space.
  • Worrying that a plain comparison like a < b will be cut. A lone angle bracket that does not form a tag is kept as typed.

About this calculator

This tool parses your input and removes everything between angle brackets — every <div>, <span>, <script> and inline style — while also decoding HTML entities such as ampersand and non-breaking-space codes back into their plain-text characters, leaving only the readable content and a character count.

Web developers and content migrators use it to pull clean text out of scraped pages or legacy CMS exports before re-importing them, digital marketers use it to turn rich HTML email templates into a plain-text fallback version, and SEO specialists use it to check the true word or character count of a page's body copy without markup inflating the number.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    This is a text extractor, not a security filter. Link addresses and image alt text disappear along with the tags, so check that nothing you need lived inside an attribute. Script and style blocks are dropped with their contents, but do not rely on the output to make untrusted markup safe to publish. If a snippet comes out with words joined or spaced oddly, post the HTML you pasted and the result you got.

Popular calculators

All Calculators