How to Decode a URL That's Been Encoded (Percent-Decoding)
Why URLs Get Encoded
A URL only permits a small set of safe characters — letters, digits, and a few symbols like -, _, ., and ~. Anything else, including spaces, non-ASCII text, and reserved characters (&, =, #, ?, /), must be converted before it can travel in a URL. That conversion is called percent-encoding (or URL-encoding).
Each unsafe byte is replaced by a % followed by its two-digit hexadecimal value. A space becomes %20, a # becomes %23, and a slash inside a query value becomes %2F. To decode a url that has been encoded, you reverse that mapping: replace every %XX sequence with the character it stands for.
https://example.com/search?q=cool%20tools%20%E6%95%B0%E6%8D%AE → https://example.com/search?q=cool tools 数据
Here are the encodings you will run into most often:
| Character | Percent-encoded |
|---|---|
| space | %20 |
| ! | %21 |
| # | %23 |
| & | %26 |
| = | %3D |
| / | %2F |
| 中 (UTF-8) | %E4%B8%AD |
How to URL-Decode Manually
Percent-decoding by hand is straightforward once you know the ASCII table. Each %XX is the hex code of one byte. %20 = 32 = space, %21 = 33 = !, %41 = 65 = A, and %E4%B8%AD is the three UTF-8 bytes for the character 中.
To decode a string manually:
- Find a
%followed by two hex digits. - Convert the hex pair to its integer value.
- Map that value to the corresponding ASCII or UTF-8 character.
- Repeat until no
%XXsequences remain, then replace any+with a space if the string came from a query string.
For a couple of characters this is quick, but a long URL with dozens of encoded sequences is tedious and error-prone. An online URL decoder does the entire thing in one pass, which is why most people reach for a tool.
Working through a small example by hand, %41%42%43 decodes as: %41 = hex 0x41 = 65 = A, %42 = 66 = B, %43 = 67 = C. So %41%42%43 is ABC. Notice that to decode multibyte text you must group the sequences correctly — %E4%B8%AD is one character, not three.
Using an Online URL Decoder
Paste your encoded string into the URL decoder and click Decode. It converts every percent-encoded sequence back to its readable character, including multi-byte UTF-8, so a long encoded query becomes human-readable in one click.
The whole reason to decode a url is to read it. A browser's address bar shows you the decoded form, but log files, analytics payloads, and copied share links are often stored fully percent-encoded. Decoding turns q=cool%20tools back into q=cool tools so you can see what the query actually means, and it is essential when debugging why a link redirects or a search term came through garbled.
https%3A%2F%2Fexample.com%2Fpath%3Fq%3Dhello%20world → https://example.com/path?q=hello world
Keep in mind the difference between the two common JavaScript helpers:
encodeURIComponentencodes almost everything, including&,=, and/, and is meant for encoding a single query value or path segment.encodeURIleaves the URL structure intact, encoding only spaces and a few characters.
If a value was encoded with encodeURIComponent, decode it with decodeURIComponent; using decodeURI instead can leave sequences like %3F untouched, producing a partially decoded URL.
Decoding happens entirely in the browser, so the URL you paste is never sent to a server. That makes an online URL decoder a safe place to inspect a signed link or an encoded query with sensitive params before you share it.
Common Decoding Mistakes
- Double encoding — if a string was encoded twice, decoding it once leaves behind
%25sequences (the encoded%). You may need to decode twice. Decode a url one pass at a time and re-check the result. - Treating
+as a space — in a query string,+usually means a space, but an application is not guaranteed to interpret it that way. Use the decoder that matches how the value was encoded. - Decoding the whole URL vs a component — decoding an entire URL can turn
%2Fback into/and change the path structure. Prefer decoding only the components you need to inspect. - Wrong charset — percent-encoded UTF-8 must be decoded as UTF-8, or multibyte text will show up as garbled characters.
FAQ
Q: How do I decode a URL?
Paste the encoded string into an online URL decoder to turn percent-encoded sequences back into readable characters.
Q: What is percent-decoding?
Percent-decoding means replacing each %XX sequence with its ASCII byte, e.g. %20 becomes a space.
Q: Why does my URL show %20?
%20 is the percent-encoded form of a space; the browser encoded the space when the URL was created.