HTML Entity Encode and Decode

Make text safe to place inside HTML, or read escaped text. Processed in your browser.

Your files stay with you. Your files never leave your browser. This tool runs on your device: nothing is uploaded to our servers, so there is nothing for us to store or see.

How to use it

  1. Paste your text or HTML.
  2. Choose Encode or Decode and the options.
  3. Copy or download the result.

Where it helps

Showing code

Display HTML tags as text in a blog post or documentation.

Templates

Escape special characters before pasting text into an email or CMS template.

Reading escaped text

Decode & and ' clutter from exported data.

Good to know

  • Stays in your browser

    Everything is worked out on your device and never sent to our servers.

  • Not a security layer

    Your framework must escape output in the right context.

  • Unknown names kept

    Unrecognised entities are left untouched.

Questions people ask

How do you convert special characters to HTML entities and back?

Paste your text or HTML, choose Encode or Decode, and pick the options: use names where they exist, such as &eacute;, and also encode non-English characters if your system needs pure ASCII. Encoding always escapes & < > " and '. Decoding handles numeric references and the common named entities. Copy or download the result.

  • & < > And quotes. Always escaped.
  • &#8377; Numeric refs. Decimal and hex.
  • Names Optional. &eacute; style.
  • ASCII Option. Encode non-English.
Which characters must always be escaped?
In HTML text, & < and > must be escaped, and inside an attribute value so must the quote character that wraps the value. The encoder escapes all of & < > " and ' so the result is safe in either place. Forgetting to escape & is the most common cause of broken text in HTML.
What is the difference between &#233; and &eacute;?
Both show é. The first is a numeric reference, which works for any character. The second is a named entity, which exists only for common characters. The option to use names applies only where a name exists; other characters fall back to numeric references automatically.
Does decoding handle numeric entities?
Yes. Decimal references such as &#8377; and hexadecimal ones such as &#x20B9; are decoded, both giving the rupee sign, plus the most common named entities such as &amp;, &copy; and &nbsp;. Unknown names are left untouched rather than guessed, so nothing is silently lost. Try it with your text.
Does escaping protect my site from XSS?
Escaping output is a key defence, but it must be done by your server or framework, in the right context, every time data is shown. HTML text, attributes, JavaScript and URLs each need different escaping. This tool is for quick conversions, not a security layer for your app.
When should I encode non-English characters?
Usually you don't need to: modern pages and emails use UTF-8, which shows Hindi, Tamil, accented letters and the rupee sign directly. Tick the option only when a system, such as an old template or feed, accepts plain ASCII. Each character then becomes a numeric reference.
How do I show HTML code on a web page?
Encode the code first, so < becomes &lt; and > becomes &gt;, then paste it inside a pre or code element. The browser shows the tags as text instead of running them. Most blog editors have a code block that does this for you, but this tool helps when one doesn't.
What is &nbsp;?
It's a non-breaking space: a space that stops a line from breaking at that point. It keeps things like '₹ 500' or '10 kg' together on one line. Don't use rows of &nbsp; for layout; use CSS margins and padding instead, which work better on phones.
Why does my text show &amp;amp;?
The text was encoded twice, so &amp; was escaped again. That often happens when data passes through two systems that each escape it. Decode it once or twice here to get back to the original, then fix the system that escapes it the second time.
Why does exported data show &#39; and &quot;?
Some systems save text with HTML entities, so apostrophes and quotes appear as &#39; and &quot; in CSV exports and APIs. Paste the text here and choose Decode to clean it up before using it in a spreadsheet, a message or another system. Decode once and check.
Is HTML encoding the same as URL encoding?
No. HTML encoding uses entities such as &amp; for text inside HTML. URL encoding uses percent codes such as %20 for text inside a web address. A link in HTML may need both: URL encoding for its parameters and HTML encoding for the & between them.
Can I use it for XML?
Yes, for the basics. XML needs & < > " and ' escaped in the same way, using &amp;, &lt;, &gt;, &quot; and &apos; or numeric references. XML doesn't know most HTML named entities such as &eacute;, so leave the names option off for XML and use numeric references. The XML formatter checks the result.
Does it change line breaks or spaces?
No. Encoding only replaces the special characters, and decoding only turns entities back into characters. Line breaks, spaces and all other text stay exactly as they are, so you can safely encode a whole block of text, including code, without reformatting it. Only special characters change.
Is my text uploaded?
No. Encoding and decoding happen in your browser, and nothing is sent to our servers or stored when you close the page. That keeps unpublished articles, templates and exported customer data private. Use it as often as you like with no account needed. Nothing remains after you close it.
Does it work on a phone?
Yes. Paste text on your phone, choose Encode or Decode and copy or download the result. It runs in any modern mobile browser with no app, which is handy for cleaning up text copied from a website or an export before pasting it into a message.
Is the HTML entity tool free?
Yes. It's free with no sign-up and no limit on use. It's one of the free developer tools from Marketiism, along with the URL encoder, the HTML minifier and the XML formatter. Marketiism builds software for small businesses in India. Use it as often as you need, for any project.

Want this inside your own account?

Marketiism keeps your invoice numbers, GST reports, UPI payment links and WhatsApp reminders in one place. Leave your details and we'll call to set it up for your business, or start the trial yourself.

Start free trial

We use this only to contact you about Marketiism. No spam.

More Developer tools

XML Formatter

Pretty-print or minify XML and find unclosed or mismatched tags.

JSON Formatter

Format, validate and minify JSON, and see exactly which line has a mistake.

JSON to CSV

Turn a JSON list of records into CSV for Excel or Google Sheets.

CSV to JSON

Convert CSV rows into a JSON list, with numbers and true/false detected.

Try it on your own business for two weeks.

14 days free, no card. If you get stuck setting up WhatsApp, we'll get on a call and do it with you.