What Is Percent-Encoding?
Percent-encoding represents characters that are awkward inside URLs as a % followed by two hexadecimal digits. The sequence %48%65%6C%6C%6F decodes to "Hello". Servers, analytics dashboards, and browser address bars all rely on this scheme to move arbitrary text through URL-shaped channels.
URL Decoder reverses that process using JavaScript's decodeURIComponent, turning encoded fragments back into the original readable string.
Reading Encoded Query Strings
A typical analytics or redirect URL might look like:
https://example.com/search?q=open%20source%20tools&ref=newsletter%2324
To read just the search term, copy open%20source%20tools into the decoder. The output open source tools confirms what the user typed. Similarly, newsletter%2324 decodes to newsletter#24.
Diagnosing Malformed Encodings
Decoding fails when the byte sequence is invalid. Common causes in real-world data:
- Truncated copy-paste — A log line cut mid-sequence leaves
%2without the final digit. - Manual encoding mistakes — Someone replaced spaces with
%alone instead of%20. - Mixed encoding layers — A value encoded twice shows
%2520for a space; one decode pass yields%20, a second yields a space.
When the tool reports an error, search the input for % characters and verify each is followed by two valid hex digits (0-9, A-F, a-f).
Plus Signs vs. Percent Spaces
HTML form submissions often represent spaces as + in query strings. decodeURIComponent does not treat + as space — that behavior belongs to application/x-www-form-urlencoded parsers. If your input uses plus notation, replace + with %20 before decoding, or decode form-style strings with the appropriate function in your codebase.
Worked Examples
| Percent-encoded input | Decoded plain text | Notes |
|---|---|---|
| hello%20world%21 | hello world! | %20 → space, %21 → ! |
| redirect%3Dhttps%253A%252F%252Fexample.com | redirect=https%3A%2F%2Fexample.com | First pass on a double-encoded URL; run a second pass to get redirect=https://example.com |
| Caf%C3%A9%20%26%20Tea | Café & Tea | Two-byte UTF-8 sequence %C3%A9 → é, %26 → & |
Decoding in a Debugging Workflow
When investigating broken redirects or garbled API parameters, alternate between URL Encoder and URL Decoder. Encode the expected plain text, compare it to what arrived on the wire, and note where they diverge. You can also test URL extraction patterns in the Regex Tester or fingerprint canonical URLs in the Hash Generator.