Developer Tools4 min read•October 8, 2026

How to Escape HTML Characters, Encode Entities and Strip Tags to Plain Text

Learn how the five actions differ, which characters each one converts, and how to copy safe markup for code samples, templates or plain text.

S
SmartToolPack Dev Desk✓ Verified
Reviewed by the GreenCode Developer Tools Editorial Desk
Last Updated: October 8, 2026
Disclaimer: Calculations and results provided by this tool are mathematical estimates for informational and educational purposes only. They do not constitute professional financial, tax, or legal advice.
Featured Utility Tool

HTML Escape & Encoder

Open HTML Escape & Encoder

Introduction

Pasting a code sample into a page without escaping it lets the browser interpret the tags, and unescaped user text is a common source of broken layouts and injection bugs. The HTML Escape & Encoder converts text between raw and escaped forms with one of five actions and shows the result instantly. Processing happens in the browser and nothing is uploaded.

Step-by-Step Instructions

  1. Paste the markup or text into the Raw Input Code / Markup box; the character count updates underneath the label.
  2. Choose an action from the row of buttons: Escape HTML, Unescape HTML, Entity Encode, Entity Decode or Strip HTML to Text.
  3. Read the result in the Transformed Output box, which updates as the input changes.
  4. Switch actions to compare, for example Escape HTML versus Entity Encode on the same input.
  5. Press Copy Result to copy the output to the clipboard.

Key Use Cases

  • Code Samples: Escape a snippet so angle brackets display literally inside a pre block.
  • Template Cleanup: Decode entity-encoded content exported from a CMS back to readable text.
  • Plain Text Extraction: Strip tags from an HTML email body to get its text for a search index.

Frequently Asked Questions

What is the difference between Escape HTML and Entity Encode?

Escape HTML replaces exactly five characters, ampersand, less-than, greater-than, double quote and single quote, with their named entities such as < and '. Entity Encode converts less-than, greater-than, ampersand and every character from U+00A0 to U+9999 into numeric entities like <, so accented letters and many symbols are also encoded.

Does Unescape HTML handle every entity?

Unescape HTML only reverses the five named entities that Escape HTML produces. For anything else, including numeric codes and entities such as   or ©, use Entity Decode, which runs the text through the browser's own HTML parser.

How does Strip HTML to Text work?

It removes every tag matched by a simple angle-bracket pattern and trims surrounding whitespace. It does not decode entities, add line breaks for block elements, or remove the contents of script or style tags, so run Entity Decode afterwards if the text still contains codes.