What Is URL Encoding? Percent-Encoding and %20 Explained

Ever seen a link full of %20, %3D and %26? That is URL encoding. URLs can only contain a limited set of characters, so everything else – spaces, accents, emoji and characters with special meaning – is written as a % followed by a code. Here is how it works and how to avoid broken links.

Free tool
Encode or decode a URL
Encode text for safe use in URLs or decode %-encoded links, choose component or full-URL mode, and see every part and query parameter of a URL. Free.
Open URL Encoder / Decoder →

How percent-encoding works

Each unsafe character is converted to its UTF-8 bytes, and each byte is written as % plus two hexadecimal digits:

CharacterEncoded
space%20
&%26
=%3D
?%3F
/%2F
#%23
é%C3%A9
₹%E2%82%B9

Letters, digits and - _ . ~ never need encoding.

%20 or + for spaces?

  • In the path and in most modern encoding, a space is %20.
  • In HTML form data (application/x-www-form-urlencoded) a space is often written as +.

When decoding query strings from forms, treat + as a space.

encodeURI vs encodeURIComponent

FunctionUse forLeaves alone
encodeURIComponentA single value, such as one query parameterOnly letters, digits and – _ . ! ~ * ‘ ( )
encodeURIA whole URLAlso : / ? # & = and other URL structure characters

The classic bug: putting a value that contains & into a query string without encodeURIComponent. The & starts a new parameter and the value is cut off. Example: a search for “Tom & Jerry” must become q=Tom%20%26%20Jerry.

Where encoding matters

  • UTM links: campaign names with spaces or special characters – our UTM Builder encodes them for you. See the UTM guide.
  • WhatsApp and email links: pre-filled messages must be encoded – see how to create a WhatsApp link.
  • APIs: query parameters with user input.
  • Redirect URLs: a URL inside another URL must be fully encoded.

Double encoding

If you encode an already encoded value, %20 becomes %2520. If you see %25 in your links, something was encoded twice. Decode once with the URL Decoder to check.

URL encoding is not security

Encoding makes text safe to put in a URL; it does not hide it. Never put passwords or personal data in URLs – they end up in browser history and server logs. For a different kind of encoding, see what is Base64.

FAQ

What does %20 mean in a URL?

It is an encoded space.

Why do URLs need encoding?

URLs only allow certain characters. Others, and characters with special meaning like & and ?, must be encoded.

What is the difference between encodeURI and encodeURIComponent?

encodeURIComponent encodes a single value, including & and =. encodeURI encodes a full URL but keeps its structure.

How do I decode a URL?

Paste it into a URL decoder, or use decodeURIComponent in JavaScript.

Are slugs URL-encoded?

Good slugs use only lowercase letters, numbers and hyphens, so they need no encoding.

Free tool
Try the free URL Encoder / Decoder
No signup and nothing uploaded – it runs right in your browser. Browse all 74 free tools on our Free Tools page.
Open URL Encoder / Decoder →

Need a website or app for your business? Talk to Techpass Master – we design and build websites and apps for clients worldwide.

WhatsApp us📞 Call now