URL Encoder / Decoder
Encode or decode URLs and URL components. Handles percent-encoding for special characters, spaces, query strings and international characters.
Fixing Broken Requests Caused by Encoding
When an HTTP request fails in a way that looks encoding-related β a 400 response, a truncated query parameter, or a redirect landing on the wrong URL β work through the failure in a fixed order. First, check for double encoding: a value that was already percent-encoded once (by a frontend framework, for instance) and then encoded again by a proxy or gateway turns %20 into %2520, which decodes back to a literal %20 string instead of a space. Paste the suspect value into this tool's decode mode twice in a row β if the second decode still changes the text, double encoding is the cause. Second, check for a reserved character left unencoded in a place it shouldn't be β an unencoded & or = inside what should be a single parameter value gets misread as a new parameter boundary, silently truncating or corrupting the intended value.
Third, if a value contains a literal + that's arriving at the server as a space (or vice versa), you're looking at the classic form-encoding versus path-encoding mismatch β the fix is almost always to standardize on %20 and stop relying on + outside form submissions. Finally, if international or emoji characters are getting mangled, confirm the encoding step is running on the UTF-8 byte sequence rather than an intermediate representation β encodeURIComponent handles this correctly by default in JavaScript, but hand-rolled encoding logic in other languages sometimes doesn't.
curl, jq, and the Command Line Equivalents
Every encode/decode operation this tool performs has a direct command-line equivalent, and knowing both means you can move fluidly between a quick browser check and a scripted pipeline. curl --data-urlencode "q=hello world" encodes a form value automatically before sending it, sparing you from manually encoding query parameters in ad hoc curl commands. In Python, urllib.parse.quote() mirrors encodeURIComponent's behavior (with quote_plus() available for the form-encoded, space-as-plus variant), while urllib.parse.unquote() reverses it. If you're processing JSON with jq, the @uri format string percent-encodes a string value inline β echo '"hello world"' | jq -r '@uri' β useful when building URLs inside a shell pipeline without reaching for a full scripting language. This browser tool is the faster path for a single one-off check; the command-line equivalents are what you'd actually put in a script, a Makefile target, or a CI step that needs to encode values programmatically rather than by hand.
Turning a Messy Query Into a Safe One
Suppose you're building a search endpoint and need to pass the raw query status: active & region=eu as a single parameter value. Typed directly into a URL, the colon, ampersand, space, and equals sign would each be misinterpreted β the & in particular would be read as starting a second parameter. Running it through encodeURIComponent produces status%3A%20active%20%26%20region%3Deu β every character with special meaning is converted to its percent-encoded form, leaving only letters and the safe unreserved characters untouched. That encoded string can now be appended safely as ?q=status%3A%20active%20%26%20region%3Deu, and the server will decode it back to the exact original text before parsing it as a single value. Running the encoded string back through the tool's decode mode confirms the round trip: the output matches the original input exactly, character for character β the check worth doing before shipping any encoding logic you didn't write yourself.
Percent-Encoding, Defined
URLs are restricted to a limited set of ASCII characters by the underlying specification (RFC 3986); anything outside that set β spaces, most punctuation, and every non-ASCII character β has to be represented instead as a percent sign followed by the character's hexadecimal byte value, so a space becomes %20 and an ampersand becomes %26. This matters to DevOps engineers constantly: query string parameters built from user input, redirect targets containing dynamic paths, webhook payloads carrying URL-encoded form data, and CDN or reverse-proxy rewrite rules all depend on correct percent-encoding to avoid the request being parsed incorrectly somewhere along the chain. Getting it wrong doesn't usually produce a clean error β it produces a request that "mostly works" until it hits a value containing exactly the wrong character, which is why encoding bugs tend to surface intermittently rather than immediately during initial testing.
Frequently Asked Questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI is designed to encode a complete URL and deliberately preserves characters that have structural meaning in URLs β specifically : / ? # [ ] @ ! $ & ' ( ) * + , ; =. This means encodeURI("https://example.com/search?q=hello world") only encodes the space, leaving the rest of the URL intact. encodeURIComponent is more aggressive β it encodes everything except unreserved characters (letters, digits, - _ . ~), making it the correct choice for encoding individual query parameter values, path segments, or fragment identifiers where characters like & and = must be treated as literal data rather than URL delimiters.
When should I URL encode a parameter value?
You should URL encode every dynamic value that you insert into a URL β particularly query string parameters, path parameters, and fragment identifiers. Characters like spaces, &, =, +, #, and % have reserved meanings in URLs and will corrupt the request if left unencoded. For example, a search query of salt & pepper must be encoded as salt%20%26%20pepper to prevent the & from being interpreted as a parameter separator. In practice, always use encodeURIComponent on each parameter value individually before concatenating them into a query string.
What is the difference between %20 and + for encoding spaces?
%20 is the canonical percent-encoded representation of a space character, defined by RFC 3986, and is valid in any part of a URL including path segments, query strings, and fragment identifiers. The + character as a space encoding is specific to the application/x-www-form-urlencoded media type β the encoding used when HTML forms submit via POST or GET β and is decoded as a space only by servers that explicitly handle this format. Critically, a + in a URL path segment means a literal plus sign, not a space. If you use + where %20 is required, your space will arrive at the server as a plus sign and cause data corruption. Using %20 everywhere is the safe, unambiguous choice.