ToolStack

URL Encoder / Decoder

Encode and decode URL components.

Advertisement

What is URL (percent) encoding?

URL encoding, also called percent-encoding, replaces characters that have special meaning in a URL — or that are simply not allowed in one — with a percent sign followed by their hexadecimal byte values. A space becomes %20, an ampersand becomes %26, and non-ASCII characters are encoded as their UTF-8 byte sequences. This lets you place arbitrary text into a query string, path segment, or fragment without breaking how the URL is parsed.

This tool encodes text into that safe form and decodes percent-encoded URLs back into readable text, using the browser's own standard functions so the results match exactly what your application code will produce. That consistency matters when you are comparing a value your code generated against one captured from a browser address bar or a server log.

Reserved versus unreserved characters

URLs divide characters into two groups. Unreserved characters — letters, digits, and a handful of symbols like hyphen, period, underscore, and tilde — are always safe and never need encoding. Reserved characters such as :, /, ?, #, [, ], @, &, =, +, and the space have structural meaning: they separate the scheme, host, path, query, and fragment of a URL.

The distinction matters because you should encode a value going into a component, not the separators that define the URL's structure. Encoding a whole URL escapes the :// and ? that the URL needs to function, while encoding only each parameter value keeps the link both valid and correct. Modern helpers such as encodeURIComponent are built around exactly this idea, escaping everything that is not an unreserved character so a single value is always safe to drop into a URL.

Common pitfalls: double-encoding and debugging

A frequent bug is double-encoding: encoding a value that was already encoded, so %20 becomes %2520. This happens when a string passes through two layers that both encode it, and it produces links that look almost right but resolve to the wrong target. Decoding once and inspecting the result is the quickest way to diagnose it.

Decoding is equally valuable for reading opaque tracking, OAuth, and redirect URLs, where campaign values and destination addresses are encoded and otherwise impossible to read at a glance. Everything runs locally, so URLs containing session tokens or internal hostnames never leave your device. Keeping a decoder handy turns an otherwise opaque, error-prone part of web development into something you can verify at a glance. Over time that habit prevents a whole class of subtle bugs caused by mismatched or double-applied encoding.

Common use cases

Building query strings

Encode parameter values that contain spaces, ampersands, or unicode so a generated link stays valid and points where you intend.

Debugging OAuth and redirect flows

Decode a long encoded redirect_uri or state parameter to read the real values and understand why an authentication flow is misbehaving.

Reading marketing and tracking links

Decode a campaign URL to see the underlying destination and UTM parameters that have been percent-encoded.

How to use

  1. Paste the text or URL component you want to transform.
  2. Choose Encode or Decode.
  3. Copy the result into your URL or code.
Advertisement

Frequently asked questions

How is URL encoding different from Base64?

URL encoding escapes only the characters that are unsafe in a URL using percent sequences and leaves the rest readable. Base64 re-encodes all data into a compact ASCII alphabet. They solve different problems and are not interchangeable.

Should I encode a whole URL or just the parameters?

Encode the individual components — such as a query parameter value or a path segment — rather than the entire URL, otherwise you will escape the separators like :// and ? that the URL needs to remain functional.

Why does decoding report an invalid sequence?

Decoding fails when the text contains a stray percent sign or an incomplete escape such as %2 without a second hex digit. Correcting or removing the malformed sequence resolves the error.

Does it handle non-English characters?

Yes. Non-ASCII characters are encoded as their UTF-8 byte sequences, which is the standard modern browsers and servers expect, and they decode back to the original text.

Is my input processed privately?

Yes. Encoding and decoding happen entirely in your browser, so URLs that include session tokens or internal hostnames never leave your device.

Related tools

Category: Developer Utilities