Use the free HTML Entity Encoder Decoder below: your data never leaves your browser — all work happens on your device, and nothing is uploaded to any server.
Why HTML entities exist
A web page is written in HTML, and HTML gives special meaning to a few characters. The less-than sign starts a tag, the ampersand starts an entity, and quotation marks delimit attribute values. If you want those characters to appear as ordinary text on the page, you cannot just type them raw. A raw less-than sign followed by letters may be read as the start of a tag and vanish from the page, or worse, break the layout of everything after it. HTML entities solve this by giving every special character a safe written form that browsers display as the character itself.
An entity looks like an ampersand, a name or a number, and a semicolon, for example & for an ampersand or < for a less-than sign. When a browser meets one, it renders the character it stands for. That is why tutorials, documentation pages and code samples are full of entities: they are the only reliable way to show HTML code inside an HTML page. Anyone who writes about the web, teaches it, or posts code snippets will need entities sooner or later.
How this tool works
Paste your text into the box and choose a direction. In encode mode, the tool walks through your text character by character and replaces each special character with its entity. Ampersands, angle brackets and both kinds of quotation mark are always encoded, because those are the characters that can break HTML. Common symbols such as copyright, registered, euro, pound and degree signs are replaced with their named entities too, which keeps the output readable for humans.
There is also an option to encode every non-ASCII character as a numbered entity. That is useful for older systems or strict pipelines that only accept plain ASCII, though for modern pages it is usually unnecessary, since UTF-8 handles accented letters and symbols directly. In decode mode, the tool does the reverse: it turns entities back into the characters they represent, including named entities and decimal or hexadecimal numbered entities, so you can recover readable text from escaped HTML.
When to use it
Use the encoder whenever you paste code or special characters into a web page, a blog post, an email template or a content management system that interprets HTML. If you are writing a tutorial that shows a div or a link tag, encode the example first, or your readers will see a rendered element instead of the code you meant to show. The same applies to forum posts and comments on sites that allow limited HTML: encoding keeps your text visible and harmless.
Use the decoder when you copy text out of a page source, an RSS feed, a database export or an API response and find it full of entities. Decoded text is much easier to read, search and edit. Developers also use decoding when debugging, because comparing escaped and unescaped versions of the same string often reveals where a double-encoding bug crept in.
Common mistakes to avoid
The most common mistake is double encoding: running already-encoded text through the encoder again. An ampersand that is part of < becomes &lt;, and the page then literally shows < instead of a less-than sign. If your output looks wrong, check whether the input was already encoded before you blame the tool. Encoding should normally happen exactly once, at the point where text enters an HTML context.
Another mistake is encoding everything by hand in a hurry and missing the ampersand itself. The ampersand must always be encoded first, because every entity starts with one. This tool handles that ordering for you, so you do not need to think about it. Finally, remember that entities are an HTML concept: they do nothing useful in a plain-text file, a spreadsheet or a chat message, where the raw characters are fine.
Tips for clean output
Encode only the text that will live inside HTML, and keep a plain-text original somewhere safe. If you need to edit the content later, edit the original and encode again, rather than decoding, editing and re-encoding, which invites mistakes. For long code samples, consider a code block with proper escaping handled by your editor or platform, and use this tool for short snippets and one-off fixes where a full setup would be overkill.
Everything runs in your browser. Nothing you paste is uploaded to any server, so you can safely encode snippets from private projects, internal documentation and work drafts without worrying about where the text goes.
Related tools
- Codificador y Decodificador de Entidades HTML (Spanish version)
- Add Line Numbers to Text
- Remove Empty Lines
