Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

HTML Entities Encode & Decode

Text

Paste text, or

CtrlV paste · Ctrl↵ run now

Encoded
Ready
Ln 1, Col 1
Runs in your browser. Nothing you paste is uploaded unless you share it.

Encode text as HTML entities (named, decimal or hex) or decode &, é and é back, the way browsers do

Encode text so it shows as written inside HTML, or decode entities like & and é back to the characters they stand for.

How to use it

  1. Choose Encode or Decode, then paste text or open a file.
  2. To encode, pick how references are written and which characters become one. To decode, say whether the text sits in an attribute value.
  3. Copy or download the result. Notes above it name anything left as written, or text that was encoded twice.

Examples

Encode a link to show its HTML on a page

Input
<a href="/menu?dish=fish&chips">Fish & chips</a>
Result
&lt;a href=&quot;/menu?dish=fish&amp;chips&quot;&gt;Fish &amp; chips&lt;/a&gt;

Characters: &<>"' (the default). That is enough for text and for attribute values in quotes.

Decode names and numbers

Input
Caf&eacute; &amp; cr&#xE8;me &mdash; &#8364;5
Result
Café & crème — €5

Encode everything outside ASCII, as decimal numbers

Input
naïve “quotes”
Result
na&#239;ve &#8220;quotes&#8221;

Write as: Decimal, Characters: Non-ASCII. For a page or email whose character set isn’t UTF-8.

The same text read as text, and as an attribute value

Input
?a=1&not=2
Result
Read as Text: ?a=1¬=2
Read as Attribute value: ?a=1&not=2

Old names like &not work without the ";" in text, so a link’s "&not=" turns into ¬ there. In an attribute value browsers leave it as written.

Names, decimal or hex

Every character can be written as a number, &#233; (decimal) or &#xE9; (hex), and the most used ones also have a name, &eacute;. Browsers read all three the same way. Names are easier to read in source; numbers also cover the characters that have no name.

With Names, a character without a name is written in hex. The apostrophe is written &#39;, which HTML 4 already read (&apos; came with HTML5).

Which characters to encode

Spaces, tabs and line breaks stay as they are in both choices.

  • &<>"': the five that can change how HTML reads your text. Enough for text in a UTF-8 page and for attribute values in quotes.
  • Non-ASCII: also every character outside ASCII (é, “, emoji). For a page, email or system that isn’t UTF-8.

How decoding reads the text

Decoding follows the HTML standard as browsers do: all 2,231 named references, the old names that work without a ";" (&copy, &amp), &#128; as € as in Windows-1252, and broken numbers as the replacement character �.

A name that isn’t an HTML entity, like &foo;, stays as written and the page lists it. When the result still holds entities (&amp;amp; becomes &amp;), the page says the text may have been encoded twice: decode it again.

Questions

Why does &nbsp; decode to a space that isn’t a normal space?
&nbsp; is the no-break space, U+00A0. It looks like a space but is a different character, so a search for a normal space won’t find it. Decoding keeps it as it is.
Do I need to encode quotes?
In text between tags, only & and < matter. Inside an attribute value, the quote that wraps it must be encoded. The default, &<>"', covers both.
Is HTML encoding the same as URL encoding?
No. Entities make text safe inside HTML (& is &amp;, < is &lt;); URL encoding makes it safe inside a URL (& is %26). A link in an href can need both: URL-encode each value, then write the & between parameters as &amp;, as the first example does.
Is my text uploaded?
No. Everything runs in your browser, so your text stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first. Templates and emails can hold keys, and the page warns you if it spots one.

Related tools