If you have ever seen a strange looking file path like /doc/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4.png or a long URL filled with %20 symbols, you have already encountered the world of URL encoding. It can look confusing at first, but once you understand what is going on, it becomes surprisingly logical.
Let’s unpack this step by step.
What is URL Encoding
Every file name or URL you type on the web must follow certain rules. A URL can only safely contain a limited set of characters. For example, letters (A–Z, a–z), numbers, and a few symbols like _, -, and / are fine. Anything outside this set must be encoded.
Encoding means converting characters into a safe format using percent signs followed by hexadecimal numbers. Each encoded part represents one byte of data. For example:
| Character | Encoded | Meaning |
|---|---|---|
| Space | %20 |
Used in URLs instead of a literal space |
/ |
%2F |
Slash symbol |
: |
%3A |
Colon symbol |
命 (Chinese) |
%E5%91%BD |
UTF-8 encoded Chinese character |
So when you see /doc/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4.png, it simply means the file name contains Chinese characters. When decoded, it becomes /doc/命名空间.png.
Why URLs Contain Encoded Characters
There are several reasons why URLs and filenames often appear encoded:
International characters
Modern websites can handle content in many languages. A Chinese, Arabic, or Tamil filename cannot be directly represented in plain ASCII, so it is encoded using UTF-8.Spaces in filenames
Spaces can cause problems in URLs. If you upload a file namedAPI Management.png, it is often converted toAPI%20Management.pngso browsers know it is a single filename and not two separate words.Reserved symbols
Characters like?,&, and#have special meanings in URLs. If you actually want them to appear in a filename, they need to be encoded so that browsers do not confuse them with query parameters or anchors.Safety and consistency
Encoding ensures that a URL is interpreted the same way across browsers, servers, and operating systems.
When to Decode and When Not To
This is where things can get tricky. Sometimes you want to decode these encodings to make data more readable. Other times, decoding can break links.
Decode when you are displaying text for a human reader.
For example, if you are cleaning a dataset and want to show/doc/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4.pngas/doc/命名空间.png, decoding makes sense.Do not decode when you are dealing with actual URLs or Markdown references.
For example,must keep the%20because Markdown expects the exact encoded path.
A common approach in automation scripts is to decode only when needed. For instance, you might decode paths that contain non-ASCII characters like Chinese or Japanese but leave normal English or symbol-based encodings alone.
How Browsers Handle It
Browsers automatically handle this process for you. When you click a link with spaces, the browser encodes them before sending the request. When the server responds, it can decode them back to the original characters. This happens silently every time you browse the web.
If you paste a decoded URL (like one containing spaces) into your browser, it will automatically re-encode it before fetching. That is why you rarely see spaces in the address bar, even if the original link had them.
Encoding in Practice
When working with JSON data, scripts, or documentation, you might see a mix of these patterns:
[
"/doc/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4.png",
"readme/API%20Management.png",
"https://api.example.com/get?path=https%3A%2F%2Fgithub.com%2Fexample"
]
In such cases:
- The first path is a Chinese filename (safe to decode).
- The second path contains a space (best kept encoded).
- The third is a full URL with query parameters (should always remain encoded).
Understanding this distinction helps you process and clean data without accidentally breaking valid links.
Final Thoughts
Encodings may look cryptic, but they are simply a translation layer between human-readable text and web-safe URLs. Knowing when and how to decode them makes your scripts and tools more reliable, especially when handling multilingual data.
If you ever encounter a file path full of percent signs, remember it’s not random noise. It’s just the web’s way of speaking in its own safe, structured language.
If you’ve ever struggled with repetitive tasks, obscure commands, or debugging headaches, this platform is here to make your life easier. It’s free, open-source, and built with developers in mind.
👉 Explore the tools: FreeDevTools
👉 Star the repo: freedevtools

Top comments (0)