URL Encoder Decoder
A URL encoder decoder converts text and URL components between plain readable form and percent-encoded form, the format browsers and servers require for characters that are not safe inside a URL. Type or paste a string, choose Encode URL or Decode URL, and the tool runs the conversion instantly in your browser using the same encodeURIComponent and decodeURIComponent functions built into JavaScript. It handles spaces, punctuation, symbols, and non-English characters, and it flags malformed percent-encoded input instead of silently returning broken text. This is useful for building query strings, debugging redirect links, cleaning up copied URLs, and checking what a link actually contains before you click it or paste it into code.
Quick answer
Encoding converts reserved and unsafe characters into percent-encoded triplets, such as a space becoming %20 and a question mark becoming %3F.
What this tells you
- •Encoding converts reserved and unsafe characters into percent-encoded triplets, such as a space becoming %20 and a question mark becoming %3F.
- •Decoding reverses that process, turning percent-encoded sequences back into their original readable characters.
- •Invalid decode input, such as a stray percent sign not followed by two valid hex digits, is detected and shown with a clear error message instead of a corrupted result.
- •The conversion is component-level encoding, meaning it is meant for individual query values or path segments, not for encoding an entire URL including its scheme and slashes.
- •Both directions run entirely in your browser, so nothing you type or paste is sent to a server.
How to Use
- 1Paste or type the text you want to convert into the input field. This can be a single word, a full query string, or a block of URL-encoded text you copied from a log or a browser address bar.
- 2Choose Encode URL if your text is plain and you need it safe for a URL, or choose Decode URL if your text already contains percent signs and you want to see the readable version.
- 3Review the output field, which shows the converted result along with the input and output character counts so you can quickly spot unexpected length changes.
- 4If you chose Decode URL and the input contains a broken percent sequence, read the error message, fix the offending characters, and run the conversion again.
- 5Copy the output result and use it directly in your query string, API request, configuration file, or wherever the converted value is needed.
How It Works
Formula
Encode: encodeURIComponent(input)
Decode: decodeURIComponent(input)The tool uses the browser's built-in URL component functions rather than a custom encoding table, so behavior matches what JavaScript in any modern browser or Node.js environment produces. encodeURIComponent replaces every character outside a small safe set (letters, digits, and the symbols - _ . ! ~ * ' ( )) with a percent sign followed by the character's two-digit hexadecimal code, using UTF-8 bytes for non-ASCII characters. decodeURIComponent reverses that by reading each %XX triplet and converting it back to the original character, throwing an error if a percent sign is not followed by two valid hexadecimal digits or if the resulting byte sequence is not valid UTF-8. Because these are component-level functions, they intentionally still encode characters like / and & and ? that are structurally meaningful in a full URL, which is correct behavior for encoding a single query parameter or path segment rather than an entire address.
Calculation note: values are processed in the order shown above, using the current input units.
Worked Examples
Encode a search query with spaces and punctuation
Each space becomes %20 and the question mark becomes %3F, since both are outside the small set of characters encodeURIComponent leaves untouched. The rest of the text is plain letters, so it passes through unchanged. This is the format you would use to safely place that phrase into a query string like ?q=hello%20world%3F.
Decode a percent-encoded query parameter
The %40 sequence decodes back to the @ symbol, restoring the readable email address. This is a common case when copying a URL from a browser address bar or a server log, where email addresses and other special characters appear percent-encoded inside query strings.
Encode text with a currency symbol and accented letters
Non-ASCII characters are first converted to their UTF-8 byte representation and then each byte is percent-encoded, which is why the accented e becomes the two-byte sequence %C3%A9 and the euro sign becomes the three-byte sequence %E2%82%AC. Spaces and the colon are also encoded as %20 and %3A. This shows why encoding matters for any text beyond basic English letters and numbers.
Attempt to decode a broken percent sequence
The percent sign here is followed by "of" rather than two valid hexadecimal digits, so decodeURIComponent cannot interpret it as an encoded byte and throws an error. The tool surfaces this as a clear invalid-input message instead of guessing at what was intended. Fixing it usually means encoding the literal percent sign itself as %25 if it was meant to appear as-is.
Encode a full query string value
The equals sign, ampersand, and spaces are all encoded because encodeURIComponent treats them as unsafe for a single component value, even though they have special meaning in a full query string. This result is meant to be used as one encoded value, for example nested inside a redirect URL as ?returnTo=category%3Dshoes%26sort%3Dprice%20low%20to%20high, not pasted directly as a standalone query string.
Common mistakes
- Encoding an entire URL, including the scheme and domain, with encodeURIComponent. This turns http:// into http%3A%2F%2F, which breaks the link. Component-level encoding is meant for individual values inside a URL, not the whole address.
- Assuming decode errors mean the tool is broken. An invalid-input error almost always means the source text has a stray percent sign or a truncated percent sequence, not a problem with the conversion itself.
- Double-encoding a value that is already percent-encoded, which turns %20 into %2520 because the percent sign itself gets re-encoded to %25. Always check whether text is already encoded before running it through the tool again.
- Forgetting that plus signs are not automatically treated as spaces. Some older form-encoding formats use + for a space, but encodeURIComponent and decodeURIComponent do not convert between + and a space, so a plus sign passes through as a literal character.
- Pasting a full multi-parameter query string and expecting a clean decode when only part of it is actually encoded. Mixed encoded and plain text can produce a result that looks correct but has not been fully normalized.
Embed this calculator on your site
Drop this single line where you want the calculator to appear. It is responsive, mobile-friendly, resizes automatically, and is free to use with attribution.
<script src="https://calctide.com/embed.js" data-tool="url-encoder-decoder" async></script>Preview the embed at /embed/url-encoder-decoder/.