HTML Entity Encoder

Convert <, >, &, quotes, and non-ASCII characters into named, decimal, or hex HTML entities online for free so text renders safely across web pages.

No uploadsNo sign-upInstant results
< > & → &lt; &gt; &amp;🚀 → &#x1F680;100% Local • Zero Uploads
Encode HTML Entities
Offline engine ready100% private in-browser workspace • Zero cloud uploads
100% Private • Zero Server File Uploads

Why Use Utiliome's Free HTML Entity Encoder?

Built from the ground up for strict privacy, instant execution, and zero friction. No subscriptions, paywalls, or account registrations required.

Safe for Emoji and Every Unicode Character

Iterates by Unicode code point (codePointAt(0)) to encode emojis and astral symbols without splitting UTF-16 surrogate pairs.

Named, Decimal & Hex Formats

Choose between Named (&eacute;), Decimal (&#233;), or Hexadecimal (&#xE9;) entity notations; characters without a name, such as emoji, fall back to a decimal reference.

Named, Decimal & Hexadecimal Output Modes

Switch between human-readable HTML5 named entities (&copy;), universal XML-safe decimal references (&#169;), or compact hexadecimal references (&#xA9;).

Selective Essential vs Full Non-ASCII Escaping

Escape only the 5 XSS-critical syntax characters (<, >, &, ", ') or encode every non-ASCII Unicode code point for legacy ASCII-only email templates.

Utiliome vs Traditional Cloud Alternatives

Compare our local-first WebAssembly engine against legacy cloud tools.

Feature Utiliome (Local Browser) Legacy Cloud Converters
Encoding Granularity Modes Choose Essential HTML/XML syntax chars (< > & " '), Non-ASCII only, or Encode All Blindly encodes every character or misses single/double attribute quotes
Entity Syntax Formats Supports Named (&mdash;), Decimal (&#8212;), and Hexadecimal (&#x2014;) output Outputs named entities only, which fail in strict XML/XHTML/SVG parsers
Astral Plane Emoji Support Iterates full Unicode code points (for..of + codePointAt(0)) for &#x1F680; Splits 4-byte emojis into two broken UTF-16 surrogate entities (&#55357;&#56960;)
Client-Side Privacy 100% local in-browser escaping with zero server uploads Sends template source code to backend servers
How it works

How to Use HTML Entity Encoder in 3 Easy Steps

No software installation required. Everything runs directly inside your web browser.

1

Input Text or Markup

Paste source code, text with HTML tags, or international symbols into the editor.

2

Select Character Scope and Format

Choose Special Characters Only, Special + Non-ASCII, or All Characters, and select Named, Decimal, or Hex entities.

3

Copy Escaped HTML Output

Copy the escaped HTML code for safe embedding inside documentation or web templates.

How HTML Entity Encoding Works

Quick Answer: Utiliome escapes raw HTML syntax delimiters (<, >, &, ", ') and optional non-ASCII Unicode characters into WHATWG-compliant named (&amp;, &lt;), decimal (&#38;), or hexadecimal (&#x26;) character references so user strings render safely inside HTML elements and attributes without XSS vulnerabilities.

Naively encoding characters using 16-bit char codes splits astral Unicode characters (such as emojis) into broken surrogate pairs (&#55357;&#56832;). This HTML encoder iterates by complete Unicode code point using for...of and codePointAt(0):

Given this input containing markup, accents, and an emoji:

<div class="test">Café & Rocket 🚀</div>

In Special Only mode with Named entities, syntax delimiters are escaped:

&lt;div class=&quot;test&quot;&gt;Café &amp; Rocket 🚀&lt;/div&gt;

Switching to Decimal mode with Special + Non-ASCII enabled converts both the accented é and the rocket emoji cleanly into whole code points (in Named mode the é would become &eacute; instead):

&lt;div class=&quot;test&quot;&gt;Caf&#233; &amp; Rocket &#128640;&lt;/div&gt;

To turn entities back into text in bulk, use HTML Entity Decoder.

Named, Decimal or Hex: Choosing an Entity Format

Quick Answer: By iterating strings over full Unicode scalar values via codePointAt(0) rather than 16-bit UTF-16 code units, our encoder produces single valid supplementary numeric references (such as &#x1F680; for 🚀) instead of illegal surrogate pair entities. All computation executes 100% locally in your browser with zero server uploads.

Choose the entity format suited for your environment:

  • Named entities (é): The most readable form. Covers the five syntax characters (&, <, >, ", ') and the HTML 4 named set: Latin-1 letters, Greek, currency and math symbols, arrows. Characters without a name, such as emoji, fall back to a decimal reference.
  • Decimal entities (🚀): Universally supported across XML, legacy browsers, and email clients where extended named entities are not defined.
  • Hexadecimal entities (🚀): Matches standard Unicode code point hexadecimal notation, preferred in modern web and XML standards.

HTML Encoder vs HTML Decoder: Which Direction Do You Need?

Quick Answer: Use HTML Entity Encoder to escape untrusted text before inserting it into HTML markup, XML feeds, or email templates, and use HTML Entity Decoder when converting escaped &amp; or &#x27; sequences back into plain readable characters. All computation executes 100% locally in your browser with zero server uploads.

Encoding and decoding are mirror images, so Utiliome keeps a dedicated page for each direction:

  • Encode (this page) when you are writing HTML and need to display characters that HTML would otherwise interpret: code samples that contain tags, product names with &, quotes inside attributes, or symbols and non-ASCII letters that must survive an ASCII-only pipeline.
  • Decode when you are reading HTML that someone else produced: scraped content, RSS feeds, exported comments or JSON fields that arrive with &amp; and &#8217; in them and need to become plain text again.

If text was encoded twice (you see &amp;lt; instead of &lt;), decode it twice; each pass removes one layer.

OWASP HTML Context Escaping Rules & Entity Format Comparison

Quick Answer: Preventing Cross-Site Scripting (XSS) in HTML element bodies and quoted attributes requires escaping all five syntax-switching characters (&, <, >, ", and '), while strict XML and SVG parsers additionally require numeric entities for any character outside the 5 predefined XML entities.

Compare the five mandatory OWASP HTML/XML escaping characters and when to choose Named vs Numeric entity modes:

Character Named (HTML5) Decimal (XML/HTML) Hex (XML/HTML) Security Role in DOM Parsing
& &amp; &#38; &#x26; Prevents arbitrary entity injection (must be escaped first)
< &lt; &#60; &#x3C; Prevents opening rogue <script>, <img>, or <iframe> tags
> &gt; &#62; &#x3E; Prevents prematurely closing HTML comments or CDATA blocks
" &quot; &#34; &#x22; Prevents breaking out of double-quoted HTML attributes (href="...")
' &apos; &#39; &#x27; Prevents breaking out of single-quoted attributes (title='...')

Explore related escaping and conversion utilities: HTML Entity Decoder, Unicode \uXXXX String Escaper, Percent-Encode Tool, and Markdown to HTML Converter.

FAQ

HTML Entity Encoder FAQ and Technical Guide

Everything you need to know about using Utiliome's free online html entity encoder.

Why does this encoder avoid broken emoji surrogates like &#55357;&#56832;?

Older encoders use charCodeAt(0), which splits supplementary characters into high and low UTF-16 surrogates. This tool uses codePointAt(0) to output the true code point (&#128640;).

When should I use Decimal entities instead of Named entities?

Named entities are only defined for specific characters in HTML specifications. Decimal and hexadecimal numeric entities work for any Unicode code point across all XML and HTML parsers.

When should I encode HTML entities?

Encode any text that comes from users or external sources before placing it inside HTML, so that < and > are shown as characters instead of being interpreted as tags and & does not start an entity. This is the standard defence against broken layouts and cross-site scripting. Also encode quotes when the text goes inside an attribute value.

What is the difference between a named entity, a decimal entity and a hex entity?

They are three spellings of the same character. The copyright sign can be written as the named entity &copy;, the decimal entity &#169; or the hexadecimal entity &#xA9;. Named entities are the most readable, while numeric entities work for every Unicode character including those without a name.

Why should I use Decimal or Hex entities instead of Named entities in XML or SVG?

Strict XML 1.0 and standalone SVG parsers only recognize five built-in named entities (&amp;, &lt;, &gt;, &quot;, &apos;). Using HTML named entities like &nbsp; or &copy; in an XML feed throws a fatal "undefined entity" parse error unless you use &#160; / &#xA0; or &#169; / &#xA9;.

Why is a single emoji encoded as two broken entities on other websites?

Older tools loop with str.charCodeAt(i), which reads UTF-16 surrogate halves (0xD800–0xDFFF) separately—and numeric entities in the surrogate range are explicitly forbidden by the HTML5 specification. Utiliome uses codePointAt(0) to emit the single valid astral code point.