HTML entities encoder and decoder

Convert special characters to HTML entities, or turn entities back into readable text. Choose the direction with the switch. Everything runs in your browser and nothing is uploaded.

Direction

How it works

  1. Paste your text

    Type or paste the text in the left box, or open a .txt file. No text to hand? Click Example.

  2. Instant result

    The result appears as you type. Change the options and see straight away what changes.

  3. Copy or download

    Copy the result with one click, save it as a file or use it as input for a next step.

Example

Encoding <p>Café & "tea" € 2.50 😀</p> gives &lt;p&gt;Café &amp; &quot;tea&quot; € 2.50 😀&lt;/p&gt;: only the characters that matter to HTML are encoded. Decoding &lt;p&gt; &amp; &eacute; &#8364; &#x1F600; &nbsp;x gives <p> & é € 😀 and a non-breaking space before the x.

Options when encoding

  • Also accented letters and other non-ASCII characters: convert accents, symbols and emoji as well, so the result is pure ASCII.
  • Use names where possible: &eacute; instead of &#233;. Characters without a name get a numeric entity.

What decoding covers

Named entities (&amp;, &copy;, &eacute;), decimal numeric ones (&#8364;) and hexadecimal ones (&#x1F600;).

Uses

Showing code samples on a web page, putting special characters in e-mail templates, and reading text copied from page source where every accent is an entity. To strip the tags and keep the text, use remove HTML tags or HTML to text. Code points in other notations are in text to Unicode.

Frequently asked questions

Which characters always have to be encoded in HTML?

The ampersand &, the less-than sign < and the greater-than sign >, and quotation marks inside attribute values. The encoder always turns them into `&amp;`, `&lt;`, `&gt;` and `&quot;`.

What does "Also accented letters and other non-ASCII characters" do?

It converts accented letters and symbols such as é and © as well: `&eacute;` or `&#233;`, `&copy;` or `&#169;`. Use it when a page or an e-mail must stay pure ASCII.

What is the difference between named and numeric entities?

Named ones such as `&eacute;` are readable but exist only for common characters. Numeric ones like `&#233;` or `&#xE9;` work for every Unicode character.

Is encoding a protection against XSS?

Encoding output in the right place stops text being read as HTML, but use the escaping of your template engine or framework rather than doing it by hand. This tool is for preparing static content and for reading encoded text.