Skip to content
⚠ TESTING ENVIRONMENT You are viewing a testing copy of Tolioo. Changes here do not affect the live website.

HTML Encoder / Decoder

Encode special characters as HTML entities or decode entities back to text. Fast, free and no signup.

  • 100% free
  • No Signup
  • Runs in your browser
0 characters · 0 lines
0 characters · 0 lines
ADVERTISEMENT
Demo Ad 728 x 90

Encode HTML in 3 simple steps

  1. 1

    Paste your text

    Add the text or HTML code that you want to escape or decode.

  2. 2

    Choose your options

    Pick Encode or Decode, what to encode and the entity format.

  3. 3

    Copy the result

    Copy the converted text or download it as a file.

HTML ENCODER GUIDE

HTML Encoder – Encode and Decode HTML Entities Online for Free

Need to escape special characters in HTML? This free online HTML encoder, also known as an HTML escape tool or HTML entity encoder, converts characters such as the ampersand, the less-than and greater-than signs and quotation marks into safe HTML entities, and the decoder turns entities back into normal text. Paste your text, choose whether to encode only the special characters, all non-ASCII characters or every character, pick the entity format (named, decimal or hex), and copy the result instantly. It is perfect for displaying HTML code on a web page, preparing text for a CMS or an email template, fixing broken characters and learning how HTML entities work. Everything runs in your browser, supports every language including Urdu, Hindi and Arabic, and needs no signup.

People search for this tool as an html encoder, html escape, escape html online, html special characters converter, html entities encoder or encode html to display code. All of these describe the same job: you want the browser to show characters such as the less-than sign, the ampersand or a quotation mark as text instead of treating them as markup. This free HTML escape tool does that in one click, with named, decimal or hexadecimal entities, and it can decode the result back. It works on Windows, Mac, Linux, Android and iPhone.

HTML Entity Encoder

Convert special characters, accented letters, symbols and emojis into HTML entities, using named, decimal or hexadecimal format, with one click.

HTML Decoder

Turn entities such as &, < and © back into readable characters. The decoder understands named and numeric entities, including hex.

Escape HTML for Display

Encode HTML code so that a browser shows the tags as text, which is the correct way to publish code examples in tutorials, blogs and documentation.

How to Encode HTML Online

Encoding HTML with this tool takes only a few seconds, and you do not need to remember any entity names. Follow these steps to escape your text.

  1. Paste your text or HTML: Copy your content into the input box, or click Try example to see how the encoder works.
  2. Select the mode: Keep Encode to create entities, or switch to Decode to convert entities back into characters.
  3. Choose what to encode: Use Special characters only for normal escaping, Special + non-ASCII if your system does not support UTF-8, or Every character for full obfuscation.
  4. Pick the entity format: Select named entities such as ©, decimal entities such as © or hex entities such as ©.
  5. Copy or download the result: Click Copy to paste it into your page, or Download to save it as a file.

What Is HTML Encoding?

HTML encoding, also called HTML escaping, is the process of replacing characters that have a special meaning in HTML with codes called HTML entities. An entity starts with an ampersand and ends with a semicolon. A browser reads the entity and displays the matching character, but it does not treat that character as part of the HTML structure. Without encoding, a piece of text such as a less-than sign followed by a tag name would be read as the start of a tag, and the visitor could see missing text, a broken layout or even unwanted code running on the page.

Which Characters Should You Escape in HTML?

Five characters should be escaped in nearly every case. The ampersand starts an entity, the less-than sign starts a tag, the greater-than sign closes a tag, and the double and single quotation marks can end an attribute value early. This is why the option Special characters only converts exactly these characters: the ampersand becomes &, the less-than sign becomes <, the greater-than sign becomes >, the double quote becomes " and the single quote becomes '. The tool uses the numeric form for the apostrophe because it works in every version of HTML.

Named, Decimal and Hex HTML Entities

There are three ways to write an entity. A named entity uses a short word, for example © for the copyright sign, and is easy for people to read. A decimal entity uses the Unicode number of the character, for example ©, and a hexadecimal entity uses the same number in base 16, for example ©. Numeric entities work for any character, including characters that have no name, such as most emojis and letters of non-Latin scripts. If you choose the named format, this tool uses a name when one exists in HTML and falls back to a numeric entity for every other character.

Common HTML Entities List

The table below shows the most used HTML entities and their numeric codes, so you can find the right code quickly.

CharacterNamed entityNumeric entityDescription
& & & Ampersand
< &lt; &#60; Less-than sign
> &gt; &#62; Greater-than sign
" &quot; &#34; Double quotation mark
' &apos; &#39; Apostrophe (single quote)
&nbsp; &#160; Non-breaking space
© &copy; &#169; Copyright
® &reg; &#174; Registered trademark
™ &trade; &#8482; Trademark
€ &euro; &#8364; Euro sign
£ &pound; &#163; Pound sign
¥ &yen; &#165; Yen sign
° &deg; &#176; Degree sign
± &plusmn; &#177; Plus-minus sign
× &times; &#215; Multiplication sign
÷ &divide; &#247; Division sign
… &hellip; &#8230; Horizontal ellipsis
— &mdash; &#8212; Em dash
– &ndash; &#8211; En dash
« &laquo; &#171; Left angle quotation
» &raquo; &#187; Right angle quotation
• &bull; &#8226; Bullet
← &larr; &#8592; Left arrow
→ &rarr; &#8594; Right arrow
♥ &hearts; &#9829; Heart

How to Display HTML Code on a Web Page

If you write a tutorial or documentation, you often need to show HTML code to your readers instead of running it. The solution is to encode the code first, so that the tags become entities, and then place the result inside a pre element with a code element inside it. The browser shows the angle brackets and the tag names as visible text and keeps the line breaks and spaces. Paste your code into the encoder, copy the result and paste it between the pre and code tags in your page.

When Do You Need to Encode Non-ASCII Characters?

Modern websites should use UTF-8 and declare it with a meta charset tag, and then accented letters, currency signs, Urdu, Hindi, Arabic text and emojis can be written directly in the page without entities. Encoding them is still useful when a file or a database uses an older character set, when an email system damages special characters, or when you copy text between programs that handle encodings differently. In these cases, choose Special + non-ASCII and the tool converts every character outside the basic English set into a safe entity.

HTML Encoding and Security (XSS)

Escaping the data that you put into a page is one of the basic defenses against cross-site scripting, because it stops user input from being read as code. Security is not only about HTML text, though. The right encoding depends on the place where the data is used, for example in an HTML attribute, in a URL or inside JavaScript. For a real application, always use the escaping functions of your language or framework, such as htmlspecialchars in PHP or the automatic escaping in Laravel Blade, and treat this tool as a helper for manual tasks, quick checks and learning, not as a replacement for secure code.

Avoid Double Encoding

A common mistake is to encode text that is already encoded. The ampersand in an existing entity gets encoded again, and the visitor sees text such as &amp;lt; instead of a less-than sign. If you see this on a page, run the text through the decoder once or twice until it shows the original characters, and then encode it only one time at the point where it is output.

Who Uses an HTML Encoder?

  • Web developers: Escape code snippets and user-generated text before they put them in a page.
  • Bloggers and technical writers: Show HTML, CSS and JavaScript examples in articles and documentation.
  • CMS and email editors: Fix broken symbols and quotes in templates and newsletters.
  • SEO specialists: Clean titles and descriptions that contain ampersands, quotes or symbols.
  • Students and teachers: Learn how HTML entities and character codes work.

Other Developer Tools You May Need

Continue your work with the URL Encoder / Decoder, the Base64 Encode / Decode tool, the JSON Formatter, or convert between plain text and markup with Text to HTML and HTML to Text.

HTML Encoder Options Explained

You decide how much of your text is converted and which kind of entity is written. The table below shows every choice.

HTML encoder settings
Setting Choices What it does
Mode Encode or Decode Encode creates entities. Decode turns entities back into text.
What to encode Special characters only Converts only &, <, >, " and '
What to encode Special + non-ASCII Also converts accented letters, symbols, emoji and scripts such as Urdu
What to encode Every character Converts letters and numbers too, which is rarely needed
Entity format Named, Decimal or Hex Writes &copy;, &#169; or &#xA9; for the same character
Encode quotes On or off Includes the double and single quote in the conversion
Line breaks as <br> On or off Keeps line breaks visible when the text is shown in HTML
Extra spaces as &nbsp; On or off Stops repeated spaces from collapsing into one

Common HTML Encoding Problems and How to Fix Them

Most encoding trouble comes from encoding twice or from picking the wrong scope. These cases are the most common.

HTML encoding problems and fixes
Problem Likely cause How to fix it
The page shows &amp;amp; The text was encoded twice Decode it once, then encode again only if needed
Accented letters are not converted The scope is set to special characters only Choose Special + non-ASCII
Line breaks disappear on the page HTML collapses plain line breaks Turn on Line breaks as <br>
Extra spaces collapse into one HTML collapses repeated spaces Turn on Extra spaces as &nbsp;
The code still runs on the page The raw text was inserted instead of the encoded result Place the encoded output inside the page, usually within pre and code tags
The result is hard to read Every character was encoded Use Special characters only for normal use

Encode HTML on Mobile, Windows and Mac

Our HTML encoder runs in your web browser, so you can escape HTML on Android, iPhone, Windows, Mac and Linux without installing a plugin. It supports text in every language, so Urdu, Hindi, Arabic, Chinese and emoji convert correctly when you choose a non-ASCII option. Open the page, paste your text and copy the result.

Tips for Encoding HTML Correctly

  • Encode at output time: Escape user text when you place it in a page, not when you store it.
  • Use UTF-8: With a correct charset you rarely need to encode letters or emoji.
  • Escape inside the right context: Text in an attribute, a script or a URL needs different escaping from text in a paragraph.
  • Decode before you re-encode: This avoids double-encoded entities such as &amp;amp;.
  • Test the result: Open the encoded output in a browser to check that it displays as you intended.

Free HTML Encoder Online

Our free HTML encoder and decoder makes it easy to escape special characters and convert HTML entities from any device. There is nothing to install and no account to create. Paste your text, choose your options, copy the result and keep your HTML safe and correct.

ADVERTISEMENT
Demo Ad 300 x 250
COMMON QUESTIONS

Frequently Asked Questions About HTML Encoding

Find answers to the most common questions about HTML entities, which characters to escape, entity formats and displaying code on a web page.

What is an HTML encoder?

An HTML encoder, also called an HTML escape tool or HTML entity encoder, converts special characters in your text into HTML entities. For example, the less-than sign becomes &lt; and the ampersand becomes &amp;. This makes sure that a browser shows your text exactly as you typed it, instead of treating it as HTML code.

Which characters must be encoded in HTML?

At least five characters should be escaped: the ampersand (&), the less-than sign (<), the greater-than sign (>), the double quote (") and the single quote ('). The first three can be mistaken for HTML markup, and the quotes matter inside attribute values. Other characters, such as accented letters and symbols, only need entities if your page does not use UTF-8.

What is the difference between named, decimal and hex entities?

They are three ways to write the same character. A named entity uses a word, such as &copy;. A decimal entity uses the character number, such as &#169;, and a hex entity uses the number in hexadecimal, such as &#xA9;. Named entities are easier to read, but not every character has a name, while numeric entities work for any character.

Does HTML encoding protect my website from XSS attacks?

Escaping user input correctly when you output it is one of the main defenses against cross-site scripting (XSS), but the right encoding depends on where the data is placed, for example in HTML text, in an attribute or in JavaScript. For a real application, use the escaping functions of your framework or language, such as htmlspecialchars in PHP, and use this tool for manual tasks and quick checks.

When should I encode non-ASCII characters?

If your page is saved and served as UTF-8 with a correct charset declaration, you do not need to encode accented letters, symbols or emojis, because browsers display them normally. Encoding them as entities is useful when your editor, database, email system or file encoding does not support UTF-8 properly.

How do I show HTML code on a web page?

Encode the code with this tool, so that the angle brackets become &lt; and &gt;, and place the result inside pre and code tags. The browser then shows the tags as visible text instead of running them. This is the standard way to display code examples in tutorials and documentation.

Is my text sent to a server?

No. Encoding and decoding run entirely in your browser, so your text is never uploaded, sent to a server or stored. You can safely convert drafts, snippets and private content.

ADVERTISEMENT
Demo Ad 320 x 50