Skip to content
MixTool

HTML entity encoder

Escape text so it displays literally on a web page — the safe way to show code samples and user input.

  • Runs entirely in your browser
  • Free · no sign-up
  • Works on phone and desktop
Loading tool…

Show HTML as text, safely

Browsers treat <, > and & as the start of tags and entities, so to display them as text you must write them as HTML entities: &lt;, &gt; and &amp;. Escaping these characters (plus quotes inside attributes) is also the core defense against cross-site scripting when you insert user input into a page.

By default the encoder escapes only the five special characters. Choose also non-ASCII to convert characters like ©, é, ₹ and emoji into entities too — using readable named entities such as &copy; where they exist, and numeric codes otherwise — for systems that can't handle UTF-8.

How to encode HTML entities

  1. 1

    Paste your text or HTML

    Code samples, user input or any text.

  2. 2

    Choose what to encode

    Only special characters, or non-ASCII too.

  3. 3

    Copy the result

    Paste it into your HTML.

Key features

  • XSS-safe escaping

    Covers &, <, >, double and single quotes.

  • Non-ASCII option

    Encode accented letters, symbols and emoji.

  • Named entities

    Uses &copy;, &mdash; and friends where available.

  • Two-way

    Swap to decode with one click.

Common uses

  • Code tutorials: Show HTML snippets inside a blog post.
  • Email templates: Make special characters render in every email client.
  • XML and RSS: Escape text for feeds and XML files.

Tips and good to know

  • Modern pages served as UTF-8 don't need non-ASCII characters encoded; escaping the five special characters is enough.
  • To reverse the process, use the HTML Entity Decoder.

Frequently asked questions

Which characters must be escaped in HTML?

Always & and <. Escape > for consistency, and " or ' inside attribute values. Those five cover every case where text could be misread as markup.

Is this enough to prevent XSS?

Escaping is essential when inserting text into HTML content and attributes, but URLs, JavaScript and CSS contexts need their own encoding. Use your framework's built-in escaping whenever possible.

Named or numeric entities?

Both display the same. Named ones like &copy; are easier to read; numeric ones like &#169; work for every character.