URL Encoder & Decoder

Effortlessly apply or reverse percent-encoding for URLs and text strings.

Some tools can take a bit log time to load properly on the background, please wait until it's complete.

Encoding Types:

  • Component (Default): Use for individual parts of a URL, like query parameters or path segments (uses encodeURIComponent). Encodes reserved characters like &, =, ?, /, :.
  • Full URI: Use for encoding an entire URI that is already formed (uses encodeURI). Does NOT encode reserved characters like ;, /, ?, :, @, &, =, +, $, ,, #.

When decoding, the tool primarily uses decodeURIComponent. If this fails, it may attempt decodeURI as a fallback.

Understanding URL Encoding (Percent-Encoding)

URL encoding, also known as percent-encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI) under certain circumstances. It's widely used to ensure that URLs are transmitted correctly and can be interpreted universally.

Why is it needed?

  • URLs can only contain a limited set of characters (ASCII printable characters).
  • Some characters have special meanings in URLs (e.g., /, ?, #, &, =). If these characters are part of data (like a search query or a filename), they must be encoded to avoid misinterpretation.
  • Non-ASCII characters (like é, ñ, 😊) must be encoded.

How it works:

Reserved characters are replaced by a % sign followed by two hexadecimal digits that represent the ASCII code (or UTF-8 byte value) of the character. For example, a space character is encoded as %20 or + (in query strings).

encodeURIComponent vs. encodeURI:

  • encodeURIComponent(str): Encodes special characters, including those with special meaning in URLs (, / ? : @ & = + $ #). Use this for encoding individual components of a URI, such as a query string parameter value or a path segment. This is generally the safer and more common function to use.
  • encodeURI(str): Encodes special characters, *except* for characters with special meaning that are essential for the structure of a URI (; / ? : @ & = + $ , #). Use this if you have a full URI that you want to ensure is correctly encoded, but you want to preserve its structural characters.

Our tool provides options for both, defaulting to component encoding which is suitable for most day-to-day tasks.