DevTools Hub

Search tools

Search for a developer tool

How to URL Encode UTF-8 Characters

Part of the Encoding Toolkit
Pattern

one %XX group per UTF-8 byte β€” 2 to 4 groups per non-ASCII character

CharacterEncoded
Γ©%C3%A92 UTF-8 bytes
€%E2%82%AC3 UTF-8 bytes
東%E6%9D%B13 UTF-8 bytes
πŸ˜€%F0%9F%98%804 UTF-8 bytes

Explanation

Percent-encoding works on bytes, not characters. A non-ASCII character is first represented as UTF-8 β€” 2 to 4 bytes, depending on the character β€” and each of those bytes becomes its own %XX group. That's why one accented letter or emoji can expand into two, three, or four %XX groups instead of one.

Plain ASCII characters (letters, digits, common punctuation) are a single UTF-8 byte each, which is why they mostly pass through unchanged β€” only the non-ASCII characters in a string actually expand.

See URL Encoding Explained for the full mechanism, or check any character's exact byte breakdown with Unicode Converter.

Valid examples

  • caf%C3%A9

    "cafΓ©" β€” only the Γ© is encoded; c, a, and f are single-byte ASCII and pass through unchanged.

  • %E6%9D%B1%E4%BA%AC

    "東京" β€” both characters are 3-byte CJK, giving six %XX groups total.

  • %F0%9F%98%80

    "πŸ˜€" β€” a 4-byte emoji, encoded as four %XX groups.

Invalid examples

  • %E6%9D

    A truncated multi-byte sequence β€” the third byte of a 3-byte character is missing, and decoding it throws "URI malformed" instead of producing a character.

  • %25E6%259D%25B1

    Double-encoded β€” the % from each byte's encoding got encoded again on a second pass.

Try it now