TinyTools

HTML Entity Encoder & Decoder

Escape characters such as <, >, &, ", and ' into HTML entities such as &lt;, &gt;, &amp;, &quot;, and &#39;, or decode them back into readable text. Free browser-based HTML encoder and decoder.

Security Note: HTML escaping can help safely display text in an HTML context, but it is not a complete replacement for proper context-aware output encoding or HTML sanitization.
Local Browser Processing
0 chars 0 lines 0 B
Ready
0 chars 0 lines 0 B

What Are HTML Entities?

HTML entities are specialized character references used in HTML and XML documents to represent characters that would otherwise be interpreted by browsers as syntax markup. Characters such as the less-than symbol (<), greater-than symbol (>), and ampersand (&) have reserved grammatical meanings in HTML (opening/closing tags and starting entity sequences).

When you want browsers to display these symbols as visible text rather than executable markup, they must be converted into their respective entity representations—either as named entities (such as &lt; for <) or numeric entities (such as &#60;).

How to Escape HTML Online

Escaping HTML replaces reserved characters with their corresponding named or numeric entities so web browsers render them safely as text without executing tags:

  1. 1 Paste Text or Markup: Enter plain text or raw HTML containing characters like <, >, &, quotes, or apostrophes into the input pane.
  2. 2 Select Encode HTML Mode: Click the Encode HTML tab at the top of the workspace.
  3. 3 Instant Processing: Characters are immediately converted into safe entity references (e.g. <div> becomes &lt;div&gt;).
  4. 4 Copy or Export: Click Copy Output to copy the escaped code snippet to your clipboard.

How to Decode HTML Entities

Decoding HTML entities reverses the transformation, converting named codes (&amp;) and numeric entities (&#39;) back into readable characters:

  1. 1 Paste Encoded String: Paste any entity-encoded text from a CMS, database export, or RSS feed into the input box.
  2. 2 Select Decode HTML Mode: Click the Decode HTML tab in the toolbar.
  3. 3 Inspect Plain Text: The tool unpacks all named and numeric entities back to human-readable symbols in real-time.
  4. 4 Copy Result: Click Copy Output to retrieve your decoded text.

Common HTML Entity Examples

Below is the primary reference table of characters that require escaping in standard HTML document contexts:

Character Entity
< &lt;
> &gt;
& &amp;
" &quot;
' &#39;

HTML Entity Encoding Example

Original text
<div class="message">Tom & Jerry</div>
Encoded HTML entity output
&lt;div class=&quot;message&quot;&gt;Tom &amp; Jerry&lt;/div&gt;

HTML Entity Decoding Example

Encoded Input
Tom &amp; Jerry
Decoded Character Output
Tom & Jerry

HTML Character Entities Reference Table

Quick reference guide for common named and numeric HTML character entities used in web development and markup authoring.

Character Entity Name Numeric Entity Description
& &amp; &#38; Ampersand
< &lt; &#60; Less-than sign
> &gt; &#62; Greater-than sign
" &quot; &#34; Double quotation mark
' &#39; &#39; Apostrophe / single quote
(space) &nbsp; &#160; Non-breaking space
© &copy; &#169; Copyright symbol
® &reg; &#174; Registered trademark
™ &trade; &#8482; Trademark symbol
€ &euro; &#8364; Euro currency sign
£ &pound; &#163; Pound sterling sign

HTML Entity Encoder & Decoder Features

1. HTML Entity Encoding

Convert special HTML characters into entity references so raw markup displays cleanly as text.

2. HTML Entity Decoding

Restore named and numeric encoded HTML entities back to their original readable characters.

3. Common Special Character Support

Accurately handle ampersands, angle brackets, quotation marks, apostrophes, and other symbols.

4. Instant Copy

Copy converted results to your clipboard with a single click and receive immediate toast confirmation.

5. Multiline Text Support

Preserve indentation, whitespace, and line breaks while processing complex multi-line snippets.

6. Browser-Based Processing

Your input text is processed locally in your browser and isn't uploaded to TinyTools for conversion.

HTML Escaping vs HTML Sanitization

While both techniques are essential for web security and application robustness, HTML escaping and HTML sanitization address two fundamentally different requirements:

HTML Escaping / Entity Encoding

Converts special characters into entity references so they are rendered as literal text instead of being parsed as HTML markup.

<script> → &lt;script&gt;

Best for: Displaying untrusted user strings, code snippets, or raw symbols safely inside an HTML text context.

HTML Sanitization

Parses HTML and actively strips or permits specific tags and attributes according to an allowed security policy (e.g. DOMPurify).

<b>Hi</b><script>...</script> → <b>Hi</b>

Best for: Rich-text editors (WYSIWYG) and user comments where intentional markup formatting must be permitted.

Security Note: HTML entity encoding is not a universal XSS sanitizer. Secure applications should use context-aware output encoding and established sanitization libraries where untrusted HTML is allowed.

When Should You Encode HTML Entities?

HTML entity encoding is useful across frontend development, content management, technical writing, and API data formatting:

Displaying HTML Source Code as Text

Present markup, templates, and tutorial examples within <pre> and <code> blocks without browser rendering.

Showing User-Submitted Text Safely

Safely render usernames, titles, or comments in an HTML text context to avoid accidental tag injection.

Escaping Special Characters in HTML

Ensure characters like & and quotes inside attributes or dynamic templates do not break layout structure.

Debugging Encoded API & CMS Content

Decode entity-encoded strings returned by legacy databases, CMS backends, or RSS feeds for visual inspection.

Preparing Documentation Examples

Convert code snippets into entity format before embedding them into static site generators or HTML templates.

Converting Copied Entity Text

Quickly convert copied HTML source containing entity references back into readable plain text or code.

Related Developer Tools

HTML Entities FAQ