URL Encode / Decode
Encode or decode percent-encoding (encodeURIComponent-style): spaces, Unicode, and query-string characters. Catch double-encoding (%2520) before you paste a parameter into an API.
Results
Enter data and click Calculate.
What URL encoding (percent-encoding) means
A URL can safely carry a limited ASCII set. Everything else β spaces, non-ASCII letters, reserved symbols β is written as percent-encoding: % plus two hex digits (a UTF-8 byte or other, depending on context). Example: space β %20, Γ© in UTF-8 β %C3%A9.
This calculator follows semantics close to JavaScript encodeURIComponent / decodeURIComponent: it encodes characters that are unsafe in a URI component (parameter value, path segment), and decodes %HH sequences back to text.
Which characters usually need encoding
- URI reserved:
:/?#[]@!$&'()*+,;=β inside a parameter value they often must be encoded or they change URL structure. - Spaces and controls β always encode in query/path components.
- Unicode (accents, β¬, emoji) β as UTF-8 percent-encoded byte sequences.
- Typically safe in encodeURIComponent: AβZ aβz, digits,
- _ . ! ~ * ' ( )β details vary by API; do not assume identity withencodeURI.
Space: %20 vs plus (+)
%20β universal percent-encoding for space (path, query, most APIs).+β in application/x-www-form-urlencoded (classic HTML forms), space is often a plus in the query string.encodeURIComponent('a b')βa%20b(not plus). Treating bare+as space is a form-encoding rule, not plain URI-component decoding.
If an API expects form-urlencoded, read the docs β mixing %20 and + is a common integration bug.
Encoding vs decoding
- Encode β user text / parameter β safe URL fragment.
- Decode β
%HHfrom logs, OAuth callbacks, copy-paste β readable text. - Encoding is not encryption: anyone can decode it. It does not protect secrets.
- Invalid
%sequences (e.g.%ZZ, truncated%C3) fail decoding β the calculator reports that.
Path vs query string
- Query (
?q=...) β encode each value with a component encoder, then join pairs with&/=. - Path β keep structural slashes; encode odd characters inside segments.
encodeURI(whole URL) preserves more reserved characters thanencodeURIComponent. - Fragment (
#...) β do not encode the opening#; encode fragment content as your app requires.
Bad practice: run encodeURIComponent on a full https:// URL for the address bar β you get a useless blob (unless you intentionally pass a URL as a parameter value).
Common mistakes and double-encoding
- Double-encode:
a bβa%20bβ again βa%2520b. Symptom in logs:%25. - Encoding an already-built query including
&β breaks parameter structure. - Decoding βjust in caseβ repeatedly β can corrupt data that legally contains
%. - Confusing Base64 with percent-encoding β different alphabets and purposes.
- Copying UI pluses into a context that expects
%20.
Worked examples
hello worldβhello%20worlda&b=c(as a value) βa%26b%3DccafΓ©βcaf%C3%A9(UTF-8)100% sureβ100%25%20sure(%must be encoded too)- Decode
a%2520bonce βa%20b; twice βa b(undoing double-encode on purpose)
Paste your own string into the form β copy the result into an HTTP request or API docs.
Quick encoding table (encodeURIComponent)
Common characters and strings β semantics close to encodeURIComponent in this calculator.
| Input | Encoded | Note |
|---|---|---|
| space | %20 | not plus (+) as in form-urlencoded |
@ | %40 | common in emails inside query values |
/ | %2F | inside a parameter value, not as a path separator |
? | %3F | otherwise starts a new query |
hello world | hello%20world | simple smoke test |
email@example.com | email%40example.com | whole address as a value |
Safe URL-building workflow
- Build the base URL with fixed parts (
https://api.example.com/v1/search). - Encode each parameter value separately (this calculator /
encodeURIComponent). - Join
?k=+ encoded +&+ more pairs β do not encode the finished query a second time. - When debugging: if logs show
%2520, decode once and find which layer over-encodes (frontend, gateway, SDK). - Regression tests: space,
&,%, emoji, empty string, already-encoded input.
Full query example: search phrase shoes & bags β value shoes%20%26%20bags β URL .../search?q=shoes%20%26%20bags.
FAQ β percent-encoding, spaces, and double-encode
Quick answers for building query strings and debugging %2520.
- encodeURI vs encodeURIComponent?
encodeURIprotects a full URL and leaves characters like:/?#.encodeURIComponentencodes more aggressively β for parameter values. This calculator targets component semantics.- Is space %20 or +?
- In a URI component, usually
%20. Plus is typical for form-urlencoded. Do not mix the rules. - How do I spot double-encoding?
- Look for
%25(an encoded %). e.g.%2520is a space encoded twice. - Can I encode a full https:// address?
- Only when that address is a *value* of another parameter. The browser bar needs a structured URL, not a fully percent-encoded blob.
- Why do non-ASCII characters become many %HH?
- UTF-8 encodes them as 2+ bytes; each byte becomes its own
%HH. - Decode throws β what should I check?
- Truncated
%sequences, non-hex digits, or text that was never percent-encoded. - Does encoding stop XSS/SQLi?
- Not by itself. It is URI transport, not input validation. The app must still escape for HTML/SQL context.
- When should the backend decode?
- Frameworks often decode query strings for you. Do not decode a second time βjust in caseβ β that causes double-decode bugs.