Skip to content
TextRuns in your browser

HTML Entity Encoder

Encode special characters to HTML entities, or decode entities back to text.

Input
No upload needed — instant
Privacy
Nothing is uploaded
Cost
Free · no sign-up · no watermark

Loading tool…

The tool is loading its code on your device. This happens once and is cached for later visits.

Processed entirely on your device

Everything you type or paste is handled by JavaScript running in this tab. No request is sent, nothing is logged and nothing is stored. Close the page and it is gone.

Overview

About the HTML Entity Encoder

Encode special characters into HTML entities, or decode entities back into readable text. Handles named, decimal and hexadecimal references, all in your browser.

HTML gives a handful of characters a special meaning: the angle brackets delimit tags, the ampersand starts an entity, and the quotes wrap attribute values. The moment you want to display one of those characters literally — to show a code sample, to echo back what a user typed — you have to represent it some other way. That other way is the HTML entity.

Encoding: text to entities

Encoding replaces the reserved characters with their entity form:

CharacterEncodedNamed form
&&&
<&lt;&lt;
>&gt;&gt;
"&quot;&quot;
'&#39;&apos;

With those escaped, a snippet like <script>alert(1)</script> renders as visible text instead of executing, which is the whole basis of output encoding as a defence against cross-site scripting.

Decoding: entities to text

Decoding runs the other way and understands all three reference forms. A named entity such as &copy; becomes ©, a decimal reference such as &#169; becomes ©, and a hexadecimal reference such as &#xA9; becomes © as well. Content copied from a page source, an email template or an exported CMS field is usually full of these, and decoding turns it back into something you can actually read.

Entities are not the only encoding

It is easy to conflate the different text encodings, but they solve different problems:

HTML entities make reserved characters safe to display in markup.

URL (percent) encoding makes characters safe to carry in a web address, turning a space into %20.

Base64 turns arbitrary binary data into ASCII text so it can travel through text-only channels.

This tool handles the first. For the other two there are dedicated URL and Base64 converters, and picking the right one is what stops a string from being mangled on the way into — or out of — a page.

Step by step

How to use the HTML Entity Encoder

  1. Paste the text you want to encode, or the escaped markup you want to decode.

  2. Choose the direction: Encode turns special characters into entities, Decode turns entities back into characters.

  3. Read the result, which updates as you type.

  4. Copy it or download it as a plain-text file.

Why use it

Benefits and common use cases

What this tool is good for, and what it deliberately does not try to do.

Escapes the characters that break markup

Encoding converts the five characters that are meaningful in HTML — ampersand, angle brackets and both quotes — into &amp; &lt; &gt; &quot; &#39;, which is exactly what you need to display code or user text safely.

Decodes every reference form

Decoding handles the named set (&copy;, &mdash;, &hellip;), decimal references like &#169; and hexadecimal references like &#xA9;, so escaped text from any source comes back readable.

Two tools in one

A single direction switch flips between encoding and decoding, so you do not need separate pages for the forward and reverse operations.

Nothing leaves the page

Both directions run in the browser. Snippets, tokens and private copy are converted locally with no request and no logging.

Questions

Frequently asked questions

Short, honest answers about quality, limits and privacy.

What is an HTML entity?

An entity is a code that represents a reserved or special character in HTML. It starts with an ampersand and ends with a semicolon — for example &lt; stands for “less than” and &#169; stands for the copyright symbol. Entities let you show characters that would otherwise be interpreted as markup.

When should I encode text?

Whenever you place user-supplied or code-like text into an HTML context. Encoding the angle brackets and ampersand stops the browser from treating that text as tags, which both preserves what the user sees and removes a cross-site scripting vector.

Does decoding handle numeric and named entities together?

Yes. A single pass decodes the named references in the common set, decimal references (&#8212;) and hexadecimal references (&#x2014;). Anything it does not recognise is left intact rather than dropped, so unknown entities survive unchanged.

Is this the same as URL encoding or Base64?

No. HTML entities are for markup display; URL encoding (percent-encoding) is for characters in a web address; Base64 is a binary-to-text encoding for embedding data. Each has its own tool here, and they are not interchangeable.