Guide

What Is URL Encoding? Percent-Encoding Explained

URLs can only contain a small set of characters safely. Everything else — spaces, ampersands, emoji, accented letters — must be rewritten as a percent sign followed by two hexadecimal digits. That rewriting is URL encoding, also called percent-encoding. You have seen it whenever a space turned into %20 in a link.

Why URLs need encoding

Some characters have jobs inside a URL: ? starts the query, & separates parameters, # jumps to a section. If your data contains one of those characters, the browser cannot tell data from structure — so the character is encoded.

For example, searching for "fish & chips" must become fish%20%26%20chips, or the & would be read as the start of a new parameter.

Which characters are safe

Letters, digits, and a few symbols (- _ . ~) never need encoding. Almost everything else does, especially spaces, &, =, ?, #, /, %, +, and any non-English characters.

An accented é becomes %C3%A9 — two encoded bytes — because URLs are built on bytes, not characters. That is why encoded text often looks much longer than the original.

Encoding is not encryption

Anyone can decode a percent-encoded string instantly — there is no key. Never treat an encoded password or token as hidden. Encoding only makes data safe to transport, not safe to expose.

Common places you will need it

URL encoding comes up constantly in everyday web work:

  • Building links with query parameters, like search or tracking links
  • Sharing a link that contains spaces or special characters
  • Debugging why a link breaks when pasted into a chat app
  • Reading an encoded URL you received and want to understand

Encode or decode text

Paste your text into the URL Encoder / Decoder and press Encode → to percent-encode it, or ← Decode to turn an encoded string back into readable text. It uses the same encodeURIComponent standard browsers use, and invalid encoded input shows a clear error.

Try it yourself

Put this guide into practice with our free URL Encoder / Decoder — no sign-up, no download.

Open the URL Encoder / Decoder