ترميز URL
ترميز وفك ترميز URL
Input
Result
URL Encoding: Why Your Browser Turns Spaces Into %20
Ever noticed those weird %20s and %3Ds in a URL? That's URL encoding (also called percent encoding). URLs only accept a limited set of characters -- letters, numbers, and a handful of symbols. Everything else -- spaces, accented letters, special characters -- needs to be converted into %XX format to travel safely across the web.
Why URLs Can't Just Use Any Character
URLs follow a spec called RFC 3986, and it's strict about what's allowed: letters, numbers, and a few symbols like hyphens and dots. That's it. Characters like & and = already have jobs in URLs -- they separate query parameters. So if your actual data contains an & or =, it has to be encoded or the server gets confused about where one parameter ends and the next begins. Same goes for spaces, non-Latin characters, and pretty much anything that's not plain ASCII.
The Characters That Get Encoded Most Often
A space becomes %20 (or + in some contexts). The & symbol turns into %26, = becomes %3D, and ? becomes %3F. Non-ASCII characters like Chinese, Japanese, or Korean text get encoded as UTF-8 first, then each byte becomes its own %XX code -- so a single character can turn into three or more %XX sequences. The forward slash (/) is a path separator, so you only encode it when it appears inside a parameter value, not in the URL path itself.
URL Encoding Tips for Developers
Golden rule: encode parameter values, not the whole URL. In JavaScript, encodeURIComponent() handles values perfectly; encodeURI() is for full URLs and leaves structural characters alone. Python developers should reach for urllib.parse.quote(). Watch out for double encoding -- it happens when you accidentally encode a string that's already been encoded, turning %20 into %2520. And always encode parameter values in API calls, because user input can contain anything.