Codepackr / encoders / URL Encoder & Decoder

URL Encoder & Decoder

Percent-encode or decode URL query strings and path segments.

Client-Side Execution & Privacy Guarantee

This utility executes 100% locally in your web browser. Your inputs, tokens, queries, and data payloads are never transmitted to any external server or backend.

URL percent-encoding replaces characters that have special meaning in URLs with a percent sign followed by two hexadecimal digits. This prevents spaces, ampersands, and non-ASCII characters from being misinterpreted by servers or browsers.

The tool encodes or decodes the entire input as a single component. It is useful for preparing query values, path segments, or fragments without affecting the structure of a full URL.

Reserved and unreserved characters

Unreserved characters (letters, digits, hyphen, underscore, period, and tilde) are left unchanged. All other characters are percent-encoded. Space becomes %20, ampersand becomes %26, and the equals sign becomes %3D.

When you encode a full query string that already contains separators, those separators are also encoded. Encode individual values separately if you need to preserve the structure of key=value pairs.

UTF-8 and non-ASCII text

Non-ASCII characters are first converted to UTF-8 bytes and then each byte is percent-encoded. A character such as é becomes %C3%A9. This matches the behavior of modern browsers and the encodeURIComponent function.

Decoding reverses the process: percent sequences are turned back into bytes and then interpreted as UTF-8. Invalid sequences produce an error rather than silent replacement.

Application/x-www-form-urlencoded differences

Some form encoders turn spaces into plus signs instead of %20. The tool follows the stricter percent-encoding rules used by encodeURIComponent, so spaces always become %20.

If you receive a string that uses plus signs for spaces, replace the plus signs with spaces or %20 before decoding, or use a form-specific decoder.

When to use this tool

  • Preparing a query parameter that contains spaces or symbols
  • Decoding a redirect URL or callback parameter
  • Encoding a path segment that includes Unicode
  • Inspecting the raw form of a percent-encoded string
  • Generating safe fragments for client-side routing

How to use the URL Encoder & Decoder

  1. Select encode or decode.
  2. Paste the plain text or the percent-encoded string.
  3. Click convert.
  4. Copy the result.
  5. If you are building a full URL, encode only the values, not the separators.
  6. Test the result by pasting it into a browser address bar or a request library.
  7. Clear the input if it contains credentials or tokens.

Worked examples

Encode a phrase with a space

Input
hello world
Output
hello%20world

The space is replaced by its percent-encoded form. Letters remain unchanged.

Encode a query-like string

Input
a=b&c=d e
Output
a%3Db%26c%3Dd%20e

Equals signs, ampersands, and the space are all encoded because the entire input is treated as one component.

Common mistakes and tips

  • Encode each query value individually. Encoding an entire URL will escape the question mark and ampersands, breaking the structure.
  • The tool uses UTF-8. Older systems that expect ISO-8859-1 will produce different percent sequences for accented characters.
  • Double-encoding occurs when an already-encoded string is encoded again. Decode first if you are unsure.
  • Percent signs that are not followed by two hex digits are left alone on encode and cause an error on decode.
  • For full URL parsing and rebuilding, combine this tool with a URL constructor in your own code.

Frequently asked questions

Why is the space encoded as %20 and not +?

The tool follows encodeURIComponent behavior. Plus signs are used by application/x-www-form-urlencoded, which is a different convention.

Can I encode an entire URL?

You can, but the result will escape every reserved character. Encode only the parts that need it.

What characters are left unencoded?

A-Z, a-z, 0-9, hyphen, underscore, period, and tilde remain as-is. Everything else is percent-encoded.

How are emoji and other Unicode handled?

They are converted to UTF-8 and each byte is percent-encoded. Decoding restores the original characters.

Does decoding validate the input?

Yes. Incomplete percent sequences or non-hex characters after a percent sign produce an error.