Advertisement
Developer Tools

HTML Encode and Decode

Convert text to HTML entities so it displays safely in a web page, or decode entities like &, " and é back to normal characters. Choose named, decimal or hex entities, encode only what is needed or every character, and strip HTML tags to get clean plain text.

  • Encode and decode entities
  • Named, decimal or hex
  • Encode non-ASCII
  • Strip HTML to text
  • Runs in your browser

Runs in your browser. Nothing you type is sent to our server.

Result

      
    
Advertisement
How to use

How to use the HTML encoder

  1. 1

    Pick a mode

    HTML encode to escape text, HTML decode to read entities, or Strip HTML tags for plain text.

  2. 2

    Paste your content

    Text, code snippets, HTML source or content copied from a CMS.

  3. 3

    Choose options

    For encoding, choose how much to encode and the entity style.

  4. 4

    Copy the result

    The result updates as you type. Copy it or download it.

HTML encode

What HTML encoding does

Some characters have special meaning in HTML. A < starts a tag, & starts an entity, and quotes end attribute values. To show those characters as text, they must be written as HTML entities: &lt;, &amp;, &quot; and so on. This is called HTML encoding or escaping.

CharacterNamed entityDecimalHex
<&lt;&#60;&#x3C;
>&gt;&#62;&#x3E;
&&amp;&#38;&#x26;
"&quot;&#34;&#x22;
'&#39;&#39;&#x27;
é&eacute;&#233;&#xE9;
non-breaking space&nbsp;&#160;&#xA0;

Use the encoder to show code examples in a blog post, put user-supplied text into HTML safely, or prepare text for systems that only accept ASCII.

Options

Encoding options

  • Only < > & " ': the minimum needed for safe HTML. Everything else, including accented letters and emoji, stays readable. This is right for almost every modern UTF-8 page.
  • Also every non-ASCII character: converts characters like é, £ and emoji to entities, for old systems, email templates or files that are not saved as UTF-8.
  • Every character: encodes even letters and digits. Occasionally used to make text harder for simple scrapers to read, for example an email address on a contact page.

Entity style controls the output: named entities like &eacute; are easiest to read, and characters without a common name fall back to numbers. Decimal and hex work for every Unicode character.

Advertisement
HTML decode

Decode HTML entities and strip tags

HTML decode turns entities back into characters. It handles every named entity in the HTML standard, plus decimal and hex numeric entities. Use it when text from a database, an RSS feed, an API or a CMS export shows &amp; or &#8217; instead of real characters, which usually means it was encoded twice. Run it again if one pass is not enough.

Strip HTML tags converts HTML into plain text. Scripts, styles and hidden templates are removed, entities are decoded, and paragraph and line breaks are kept so the text stays readable. Tick Keep link URLs in brackets to preserve where links pointed. It is useful for word counts, plain text emails, meta descriptions and moving content between systems.

Security

HTML encoding and XSS

Cross-site scripting (XSS) happens when a site puts untrusted text into a page without encoding it, letting an attacker inject <script> tags or event handlers. The fix in application code is to encode output for the context it goes into: HTML encoding for page content and attributes, URL encoding for URLs, and JavaScript escaping inside scripts. Frameworks such as Laravel Blade ({{ }}), Twig and React do this automatically, and in plain PHP use htmlspecialchars($text, ENT_QUOTES, 'UTF-8').

This tool is for one-off conversions and checking output. It runs in your browser and never sends your content anywhere. For URLs use the URL encoder, for binary data use the Base64 encoder, and to check a whole page for markup problems use the HTML validator.

Examples

HTML encode and decode examples

Encoding the text

<p>Fish & chips cost £5 "today"</p>

with the default options gives

&lt;p&gt;Fish &amp; chips cost £5 &quot;today&quot;&lt;/p&gt;

which a browser displays exactly as the original text, tags and all, instead of rendering a paragraph. Choosing Also every non-ASCII character additionally turns £ into &pound; (named) or &#163; (decimal).

Decoding works the other way. A common real-world example is text from a WordPress database or an RSS feed such as Rock &amp; Roll &#8211; It&#8217;s back, which decodes to Rock & Roll – It’s back with a proper dash and curly apostrophe.

Encoding is context-specific. HTML entities are right inside page content and attribute values, but not inside URLs, where you need percent-encoding, or inside JavaScript strings, where you need backslash escapes. Mixing them up produces visible codes like %20 or &amp; on the page, or broken links. When text looks wrong, work out which encoding was applied, and in which order, before decoding.

FAQ

HTML Encode / Decode: frequently asked questions

What does HTML encode mean?

Replacing characters that have special meaning in HTML, such as < > & and quotes, with entities like &lt; so they display as text instead of being read as code.

How do I decode HTML entities?

Choose HTML decode and paste the text. Entities like &amp;, &quot; and &#233; are converted back to the characters they represent.

What is the difference between named and numeric entities?

Named entities like &eacute; are easier to read. Numeric entities like &#233; or &#xE9; work for every Unicode character.

Why do I see &amp;amp; in my text?

The text was encoded twice. Decode it, and if needed decode it again.

How do I remove HTML tags from text?

Choose Strip HTML tags and paste the HTML. You get plain text with line breaks preserved.

Do I need to encode accented letters?

Not on modern UTF-8 pages. Only encode them for systems that cannot handle UTF-8.

Does HTML encoding prevent XSS?

Encoding output correctly is the main defence against XSS, but it must be done by your application for every untrusted value.

Is my content uploaded?

No. All encoding and decoding happens in your browser.

About Developer Tools

More about our developer tools

Everyday developer utilities for working with JSON, CSV, Base64, URL encoding, hashes and UUIDs. Every tool runs the conversion on our server with PHP's own standard functions, json_decode, base64_encode, hash(), random_bytes, so the output matches what your own code would produce.

Why server-side developer tools?

Many online formatters run a JavaScript library in your browser that behaves slightly differently from the language you actually deploy. BulkMaker runs PHP's native implementations, which follow the same RFCs (RFC 8259 for JSON, RFC 4648 for Base64, RFC 3986 for URL encoding, RFC 4122 for UUIDs) that every mainstream language implements.

Bulk by default

Each developer tool accepts many values at once, one per line, so you can hash a column of IDs, decode a list of Base64 strings, or generate 500 UUIDs in one go instead of pasting them one at a time.

Privacy and secrets

Input is processed in memory for a single request and never written to disk or a database. Even so, avoid pasting production secrets, private keys or live passwords into any online tool, rotate any credential that has been pasted somewhere you do not control.