HTML Encoder/Decoder

Escape HTML characters to safe entities, or decode entities back into raw HTML.

html-encoder-decoder.js

Encoding turns characters like < > & " into their safe HTML entity equivalents (< > & ") so they display as text instead of being interpreted as markup — essential when showing user-submitted or code content inside a web page. Decoding reverses this, turning entities back into their original characters.

How to use it

  1. Paste text or HTML into the input box.
  2. Click Encode to escape special characters, or Decode to reverse entities back to characters.
  3. The result replaces the box content.
  4. Copy the result for use in your code or CMS.

Frequently asked questions

Why do I need to encode HTML before displaying it?

If you show raw user input containing < or > inside a web page without encoding it, it can be interpreted as real HTML tags — encoding prevents that and also helps prevent injection attacks.

What characters get encoded?

The core five: & < > " and ' become & < > " and ' respectively.

Can I decode entities that use numeric codes like '?

Yes, both named entities (like &) and numeric entities are decoded correctly.