URL Encode / Decode / HTML Entity Encode / Decode

The targets differ: URL encoding turns characters into %XX byte sequences so content can travel safely in a URL; HTML entities turn characters into &name; or &#nnn; so content can enter HTML text safely. Using the wrong one for the container does nothing useful and can double-encode.

URL Encode / DecodeHTML Entity Encode / Decode
Output shapePercent sequences like %E4%B8%ADEntities like &, ©, '
ContainerURL query strings and pathsHTML / XML text and attribute values
Who decodesBrowsers and servers, by URL rulesThe HTML parser, while rendering
Classic mistakeRe-encoding an encoded string: % becomes %25Putting entities in a URL, where nothing decodes them
Encode & Crypto

URL Encode / Decode

URL (percent) encoding turns special characters into %XX form so the URL transmits safely. Encode: escapes with encodeURIComponent Decode: restores with decodeURIComponent Letters, digits and the safe characters -_.!~*'() are preserved

Encode & Crypto
Encode & Crypto

HTML Entity Encode / Decode

HTML entity encoding turns special characters into safe entity references. Encode: turns < > & " into entities Decode: turn entities back into characters Covers 37 common HTML entities

When to use URL Encode / Decode

  • Building links from search terms or non-ASCII parameters.
  • Embedding a callback URL inside another URL's parameter.
  • Handling values containing &, = or # that would otherwise be read as delimiters.

When to use HTML Entity Encode / Decode

  • Displaying < > & in HTML, where they would otherwise be parsed as markup.
  • Rendering user input into a page (plus server-side escaping).
  • Inserting symbols like ©, € or → into templates or emails.

Verdict

Decide by container: percent-encoding for URLs, entities for HTML. When both apply the order is URL-encode first, then HTML-escape the result — the reverse leaves entities that never decode.

Other comparisons

All tools