URL Encoder and Decoder for Query String Values
Encode or decode URLs and URI components instantly
What is URL encoding?
URLs can only carry a limited set of characters. Everything else — spaces, &, ?, =, #, /, non-ASCII text — must be percent-encoded: each byte becomes % followed by two hex digits, so a space becomes %20 and é becomes %C3%A9. Without it, a & inside a query value splits the parameter in two and a # silently truncates everything after it.
This tool wraps JavaScript's encodeURIComponent and decodeURIComponent — the strict component-level functions that encode every reserved character, which is what you want for a single query-string value or path segment. Both directions run entirely in your browser; nothing you paste is uploaded or logged.
When to use it
Encode when you're building a URL by hand and a value contains reserved characters: a redirect_uri for an OAuth flow, a search query with spaces and ampersands, a callback URL nested inside another URL. Decode when you're doing the reverse — reading a %-riddled query string out of an access log, a Referer header, or a tracking link and trying to see the actual values.
Decoding is also the fast way to unwrap layered redirects: marketing and SSO links often encode a URL inside a URL inside a URL, and each pass through the decoder peels off one layer. Once you have a result worth discussing, the "Copy link to this result" button gives you a permalink that restores the exact input and mode for whoever opens it.
Example
Say you need to pass https://app.example.com/callback?next=/dashboard as a redirect_uri parameter. Paste it in encode mode and you get https%3A%2F%2Fapp.example.com%2Fcallback%3Fnext%3D%2Fdashboard — safe to drop into another URL because the ?, = and / can no longer be misread as structure of the outer URL. Paste that blob back in decode mode and the original returns, confirming nothing was mangled.
encodeURIComponent vs encodeURI
JavaScript has two encoders, and picking the wrong one is the usual cause of broken links. encodeURIComponent — the one this page uses — escapes everything except letters, digits and - _ . ! ~ * ' ( ), so reserved characters like / ? & = # : and + all become %XX. That's right for one piece of a URL: a query value, a path segment, or a whole URL passed as a parameter. encodeURI assumes it's been handed a complete URL and leaves the structural characters ; , / ? : @ & = + $ # alone, escaping only spaces, non-ASCII text and a few unsafe characters.
The practical difference: encodeURI("https://x.com/?q=a&b") leaves the & in place, so b becomes a second parameter, while encodeURIComponent("a&b") gives a%26b, which survives. For building query strings in modern code, new URLSearchParams({ q: "a&b c" }).toString() handles the encoding for you — but it returns q=a%26b+c, with + for the space, because URLSearchParams follows form-encoding rules rather than encodeURIComponent's.
If you paste a full URL here in encode mode, expect https%3A%2F%2F… — correct when the whole URL is a parameter value, wrong if you wanted to keep it clickable.
URL encoding in Python, PHP and Java, and + vs %20
Each language has a component-style and a form-style encoder, and they differ mainly in how they treat spaces and slashes.
Python: urllib.parse.quote("a b/c") returns a%20b/c — it leaves / alone by default, so pass safe="" to match encodeURIComponent and get a%20b%2Fc. urllib.parse.quote_plus("a b") returns a+b in form style, and urlencode({"q": "a b"}) builds a whole query string the same way; decode with unquote or unquote_plus. PHP: rawurlencode("a b") gives a%20b (RFC 3986, the closest match to this page) while urlencode("a b") gives a+b for form data; decode with rawurldecode or urldecode respectively. Java: URLEncoder.encode("a b", StandardCharsets.UTF_8) returns a+b — despite the name it's a form encoder — so for a path segment or a strict query value, follow it with .replace("+", "%20").
%20 and + both appear as spaces, but + means space only in form-encoded data (query strings and POST bodies); in a path, + is a literal plus sign. When a decoded value shows + where spaces should be, the producer used form encoding — replace + with %20 before decoding here.
How to use the URL Encoder and Decoder for Query String Values tool
- 1
Choose Encode or Decode
Encode makes a value safe to embed in a URL; Decode turns %XX sequences back into readable text.
- 2
Paste your text
A full URL, a single query value, or a percent-encoded blob from a log.
- 3
Hit Convert
The result appears in the output panel; errors (like a stray %) are shown below.
- 4
Copy or share
Copy the output, or copy a permalink that restores your exact input and mode.
Frequently asked questions
Why does decoding throw 'URI malformed'?
The input contains a % that isn't followed by two valid hex digits — usually a literal percent sign that was never encoded, or a string that was truncated mid-sequence. Find the bare % and either remove it or complete the escape (a literal percent should be %25).
Should I encode a whole URL or just the value?
Just the value. This tool uses encodeURIComponent, which encodes reserved characters like :, / and ? — correct for a single parameter value or path segment, but it will break a full URL's structure if you feed one in. Encode each dynamic piece, then assemble the URL.
Why did my + turn into a plus sign instead of a space?
Encoding spaces as + is a legacy convention specific to application/x-www-form-urlencoded form bodies. Standard percent-encoding uses %20, and this tool follows the standard — decodeURIComponent leaves + alone by design. Replace + with %20 before decoding old-style form data.
Is anything I paste sent to a server?
No. Both directions run entirely in your browser. That includes the shareable permalink: your input lives in the URL fragment, which browsers never transmit to any server.
Which characters don't need to be URL-encoded?
RFC 3986 defines the unreserved set as A–Z, a–z, 0–9 and - . _ ~ — these never need escaping. encodeURIComponent also leaves ! * ' ( ) unescaped. Everything else, including spaces and all non-ASCII text, is percent-encoded as UTF-8 bytes.
Why do I see %2520 in my URL?
The value was encoded twice. %25 is the encoding of % itself, so %2520 is an already-encoded space (%20) encoded again. Decode once to get back to %20 and find the step in your code that encodes an already-encoded value — encode raw values exactly once, when you assemble the URL.
Can I decode a whole URL with this tool?
Yes. Decoding a full URL is safe for reading it: every %XX sequence is turned back into its character, including %2F, %3F and %26. The result is good for inspection, but if those characters were deliberately encoded inside a parameter value, the decoded string may no longer work as a URL.
Related on TechLogHub
Related Encoding Tools
Base64 Encoder and Decoder with UTF-8 Support
Encode plain text to Base64 or decode Base64 back to text
HTML Entity Encoder and Decoder with Numeric Entities
Encode or decode HTML entities in text
JWT Decoder with Readable exp and iat Claims
Decode and inspect JWT tokens without verification
Binary Translator for UTF-8 Text and Emoji
Translate text to binary and binary to text with UTF-8, plus hex, decimal and octal byte views
Get the next tool before you need it
One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.