Convert special characters to HTML entities, or turn entities back into characters.
How to use
- Paste text or HTML.
- Pick Encode or Decode.
- Press Convert.
Good to know
Encoding the characters & < > " and the apostrophe prevents HTML from being interpreted as markup. Non-ASCII characters become numeric entities.
How Do You Encode and Decode HTML Entities Online?
A free online HTML entity encoder and decoder converts special characters such as angle brackets, ampersands and quotes into safe entity codes, and turns entity codes back into the characters they represent. Paste your text, choose Encode or Decode, press the button, and the result appears. This guide explains what is converted, how the decoder works, and what to watch for.
What Does the HTML Entity Encoder and Decoder Do and Why Is It Useful?
In HTML, a few characters have a special meaning. The less-than sign starts a tag, the ampersand starts an entity, and quotes close attribute values. If you want to show those characters on a page as ordinary text, they must be written as entities. Other characters, such as accented letters and currency symbols, can also be written as entities when a page or system cannot be trusted to handle them correctly.
The tool helps when you need to:
- Show a code sample on a web page without the browser treating it as markup.
- Put text containing quotes or ampersands safely inside an attribute or template.
- Convert accented letters and symbols into plain ASCII text.
- Read a block of text full of entities and see the real characters.
How Does It Work Under the Hood?
In Encode mode, the tool goes through your text character by character. The five markup-sensitive characters, & < > " and the apostrophe, are replaced with named or numeric entities. Any character with a code above 126 is replaced with a numeric entity, written with an ampersand, a hash, the decimal code and a semicolon. The letter é, for instance, becomes é. Ordinary letters, digits, spaces and punctuation with codes up to 126 are left alone.
In Decode mode, the tool uses the browser's own HTML parsing to convert entities back into characters. That means it understands the same named and numeric entities a browser would, instead of relying on a short custom list.
Results appear only after you press the Convert button. Nothing changes while you type.
How Do You Use the HTML Entity Encoder and Decoder Step by Step?
- Paste or type your text into the text area.
- Choose Encode or Decode.
- Press the Convert button.
- Read the converted text shown below the form.
- To check the result, switch the mode, paste the output back in and press Convert again. You should get your original text.
What Do Real Conversions Look Like?
The following examples use the standard rules for these entities. Check each by decoding it again.
Example 1: Showing a tag as text
Input: <p>Hello</p> in Encode mode. The angle brackets are converted, giving:
<p>Hello</p>
Placed in a page, this displays the literal text <p>Hello</p> instead of a paragraph.
Example 2: An ampersand
Input: Tom & Jerry in Encode mode. Result:
Tom & Jerry
Example 3: Quotes in an attribute
Input: say "hi" in Encode mode. Result:
say "hi"
Example 4: Accented letters
Input: café in Encode mode. Result:
café
The letter é has code 233, which is above 126, so it becomes a numeric entity.
Example 5: A currency symbol
Input: €5 in Encode mode. Result:
€5
The euro sign has code 8364.
Example 6: Decoding
Input: <b>bold</b> in Decode mode. Result:
<b>bold</b>
Example 7: Decoding a numeric entity
Input: café in Decode mode. Result: café.
What Is the Difference Between Named and Numeric Entities?
A named entity uses a short word, such as & for the ampersand or < for the less-than sign. A numeric entity uses the character's code number, such as é for é. Numeric entities work for any character, which is why the encoder uses them for everything above code 126. Named entities are easier to read for the handful of special characters that have them.
When you plan to display decoded text in a new place, remember that decoding returns real characters. If the result is then pasted into an HTML page unescaped, characters like the less-than sign become live markup again. Encode before publishing text you do not fully control.
When Should You Encode Entities?
The most common case is displaying markup as text. Tutorials, documentation and support articles often include snippets of HTML, and the angle brackets in those snippets would otherwise be interpreted as real tags. Encoding them makes the snippet appear exactly as typed.
A second case is attribute values. If a value contains double quotes and the attribute itself is wrapped in double quotes, the value ends early and the rest of the markup breaks. Encoding the quotes keeps the attribute intact.
A third case is plain ASCII delivery. Some older systems, templates and mail workflows mangle characters above the basic range. Writing those characters as numeric entities keeps the text readable on arrival, because the entity itself uses only simple characters. Modern pages served as UTF-8 rarely need this, but the option remains useful.
Example 8: Mixed content
Input: 5 < 7 & 9 > 2 in Encode mode. Result:
5 < 7 & 9 > 2
Every sensitive character is replaced and the digits and spaces are untouched.
What Tips Help You Get Better Results?
- Encode first, then place the output in your page. Do not encode text that has already been encoded, or ampersands will be doubled.
- Use Decode on a small sample first if you are unsure what an entity-heavy block contains.
- Keep a page's declared character set in mind. Numeric entities work even where a page is not set to UTF-8.
- For tidy case or whitespace before encoding, the Case Converter and Remove Extra Spaces tools help.
- If you work with structured data as well, the JSON Formatter is a useful companion, and the URL Encoder and Decoder covers percent-encoding.
What Common Mistakes Should You Avoid?
- Encoding twice. Running the output through Encode again turns every ampersand into another entity, so the page shows entity codes instead of characters.
- Forgetting the semicolon. An entity needs its closing semicolon to be recognised reliably.
- Assuming Decode makes text safe. Decoding does the opposite of protecting. It produces raw characters that may be interpreted as markup.
- Treating entities as security. Encoding is one part of handling untrusted text, not a complete defence by itself.
What Happens to Characters Below Code 127?
Letters, digits, spaces and most punctuation have codes up to 126, so the encoder leaves them exactly as typed, apart from the five sensitive characters. This keeps encoded output readable. A sentence like Fish and chips costs 5 stays almost unchanged, and only the symbols or accented letters stand out. If your text has no markup characters and no characters above code 126, the encoded output matches the input.
Who Uses an HTML Entity Encoder and Decoder?
Web developers use it to display code samples and escape template content. Bloggers and writers use it to show angle brackets and quotes in posts. Email and newsletter builders use it to keep symbols from breaking. Students learning HTML use it to see how characters map to codes. Content editors use it to clean up text copied from pages full of entities.
Is Your Text Private?
Yes. Encoding and decoding run in your browser. Nothing you enter is uploaded to a server or stored, and refreshing the page clears it.
What Are the Limitations?
- Encode handles the five sensitive characters and anything above code 126. Characters in between are left unchanged.
- Characters above code 126 always become numeric entities, never named ones.
- Decode relies on the browser's HTML parsing, so unusual or invalid entities are handled the way a browser handles them.
- Results appear when you press Convert, not as you type.
- There is no copy button, file upload or download. Select the output and copy it yourself.
Frequently Asked Questions
What is an HTML entity?
It is a text sequence starting with an ampersand and ending with a semicolon that represents a character.
Which characters are encoded?
The ampersand, less-than, greater-than, double quote and apostrophe, plus every character above code 126.
Why does é become a number code?
It has a code above 126, so the encoder writes it as a numeric entity, which is é.
How does decoding work?
It uses the browser's own HTML parsing to turn entities back into characters.
Can I decode named entities like the copyright sign?
Because decoding uses browser parsing, standard named entities are understood the same way a browser reads them.
Why did my ampersands double?
Text was probably encoded twice. Decode once and encode again from the original.
Is my text stored?
No. The tool runs in your browser and nothing is uploaded or saved.
Convert Your Text Now
Entities are simple once you see them side by side with the characters they stand for. Paste a snippet, press the button and compare it with the examples above. Browse more utilities among our free tools.
