Skip to content
CalcTide logo
Tech

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.

TechBy

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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

ModeEncode URL
Inputhello world?
Resulthello%20world%3F

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

ModeDecode URL
Inputuser%40example.com

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

ModeEncode URL
Inputcafé price: €25
Resultcaf%C3%A9%20price%3A%20%E2%82%AC25

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

ModeDecode URL
Input100%off
ResultInvalid URL-encoded input. Check percent-encoding and try again.

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

ModeEncode URL
Inputcategory=shoes&sort=price low to high
Resultcategory%3Dshoes%26sort%3Dprice%20low%20to%20high

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/.

Frequently Asked Questions

It converts reserved and unsafe characters, such as spaces, question marks, and ampersands, into percent-encoded values like %20 and %3F so they can be safely included in a URL component without being misread as part of the URL's structure.
The tool shows a clear invalid-input error instead of returning broken or partially converted output. This happens when a percent sign is not followed by two valid hexadecimal digits or when the decoded bytes are not valid UTF-8.
No. Encoding and decoding both run fully client-side in your browser using JavaScript's built-in URL component functions, so the text you enter never leaves your device.
Spaces are not allowed in a raw URL, so encodeURIComponent replaces each space with its percent-encoded hexadecimal value, %20, which browsers and servers correctly interpret as a literal space character.
Encode only the individual values you are inserting into a URL, such as a search term or an email address, not the entire address. Encoding the whole URL will percent-encode structural characters like the colon and slashes, breaking the link.
Non-ASCII characters are converted to UTF-8 bytes before encoding, and many of those characters use two or three bytes, so each byte gets its own percent-encoded pair. That is why a single accented letter or a currency symbol can expand into several %XX sequences.
encodeURIComponent, which this tool uses, encodes nearly every reserved character and is meant for individual URL components like a query value. encodeURI leaves characters like / : ? & untouched because it is meant for encoding a complete URL that already has its structure in place.
Yes. Paste the percent-encoded portion of the address into the field, choose Decode URL, and the tool converts it back to readable text, which is useful for checking exactly what a shared or shortened link points to before you open it.
decodeURIComponent treats a plus sign as a literal character, not as an encoded space, because that convention comes from an older form-encoding format rather than standard percent-encoding. If you need plus-to-space conversion, replace the plus signs with %20 before decoding.
It estimates url encoder decoder outputs using the visible inputs and formula assumptions on this page.

Explore More in Tech