Ambimat GroupAmbimatAmbiSecureV2XeSIM & eUICCAmbiAutomationEngineering BlogAhmedabad · India · Est. 1982
Encoding utility

URL Encoder and Decoder

Percent-encode and decode URLs and URL components with the browser's own encodeURIComponent, encodeURI, decodeURIComponent, and decodeURI. Toggle space as %20 or +, and see malformed input flagged instead of silently mangled.

Client-sideRFC 3986UTF-8

How to use this tool

What it does

Percent-encodes and decodes URL components per RFC 3986.

When to use it

Use it when a redirect URI, deep link or query parameter carries reserved characters and you need the exact encoded or decoded form.

Worked example

Encode a b&c to a%20b%26c, or decode a percent-escaped callback URL.

Input

Result

Type something to convert.
All encoding and decoding runs locally in your browser. Nothing is uploaded — safe for URLs that carry tokens or session identifiers.

What URL encoding is for

A URL has a strict syntax. A handful of characters — the colon, slash, question mark, hash, ampersand, equals sign, and a few others — act as structural delimiters that mark where the scheme, host, path, query, and fragment begin and end. Any data you want to carry inside one of those parts must avoid colliding with the delimiters, and any byte outside the small set of URL-safe characters must be escaped. Percent-encoding solves both problems: each unsafe byte is written as a % followed by its two-digit hexadecimal value, and multi-byte UTF-8 characters become a run of those escapes.

This tool wraps the four standard JavaScript primitives. encodeURIComponent escapes everything that is not an unreserved character, so it is the right choice for a single query value or path segment. encodeURI assumes you have already assembled a complete URL and leaves the reserved delimiters intact so the address keeps working. The two decode functions reverse each direction. Because they are the browser's own implementations, the output matches exactly what your application code will produce at runtime.

When to use it

Reach for component encoding whenever you build a query string or insert user data into a path — a search term, an email address, a redirect target, or a base64 token that contains +, /, or =. Reach for full-URL encoding when you have a finished address that contains spaces or accented characters and you only want the unsafe bytes fixed, not the structure rewritten. On the decode side, paste a percent-encoded value from a server log, a browser address bar, or an OAuth redirect_uri to read it back as plain text and confirm it was encoded correctly.

Input and output

The input box takes any text. The result panel shows the converted string plus badges with the active mode, the character count, and the UTF-8 byte count, so you can spot expansion at a glance — one accented letter or one reserved character often becomes three or more output characters. The + versus %20 toggle applies only to the two encode modes: with it on, spaces become + for form-style query values; with it off you get the standards-default %20. On decode modes the toggle additionally turns a literal + back into a space first, matching how form data is read. Decoding is wrapped in a guard: a lone % or an invalid escape produces a clear inline error showing the offending sequence rather than a wrong or partial value.

Common mistakes

Related tools

Base64

Decode tokens you find in query strings — many JWTs and IDs are Base64 before they are URL-encoded.

Open Base64 →

Base32

Case-insensitive encoding used for TOTP secrets and other values that travel in URLs.

Open Base32 →

More utilities

Parsers, decoders, and references for smart-card and FIDO engineers.

All resources →

Frequently asked questions

What is the difference between encoding a full URL and a URL component?

Encoding a full URL (encodeURI) leaves the characters that hold a URL together — such as the colon, slash, question mark, ampersand, and hash — untouched so the address still works. Encoding a component (encodeURIComponent) escapes those same characters too, because a single query value or path segment must not be allowed to contain delimiters that would change the URL's structure. Use component encoding for individual query values and path pieces; use full-URL encoding only on an already-assembled address.

When should a space become %20 instead of +?

Inside the path of a URL a space must be %20, and JavaScript's encodeURIComponent always emits %20. The plus sign only means space in the application/x-www-form-urlencoded format used by HTML form submissions and many query strings. This tool offers a toggle so you can produce + for form-style query values, but %20 is the safer default for paths and for servers that do not apply form decoding.

Why does decoding throw a 'malformed URI' error?

decodeURIComponent throws a URIError when it meets a percent sign that is not followed by two valid hexadecimal digits, or a percent sequence that does not form valid UTF-8. A lone % from human-typed text, or a value that was double-encoded and then partially decoded, are the usual causes. This tool catches the error and shows exactly what failed instead of returning a wrong value.

Does anything I paste leave my browser?

No. All percent-encoding and decoding runs locally in JavaScript on this page using the browser's built-in encodeURIComponent, encodeURI, decodeURIComponent, and decodeURI functions. Nothing is uploaded, logged, or sent to a server, so it is safe to process URLs that carry tokens or session identifiers.

Which characters never need percent-encoding?

The unreserved set: A-Z, a-z, 0-9, hyphen, period, underscore and tilde. Everything else is either reserved with a structural meaning or must be encoded to appear literally.