Skip to content
Server-sideDeleted in 30 minutes

URL Encoder and Decoder

Encode a complete URL or just the value that will go inside a query string, then decode it again when you need to read what an API received. The component and URI modes are deliberately separate because encoding an entire address when you only meant to encode a search term can break its scheme, slashes, and separators. Private endpoints, tokens, and test payloads deserve caution, which is why nothing pasted here is stored — it is transformed and discarded per request.

Use this without the search next time. Prathom Workbench puts Prathom's tools in your toolbar.

Add to Chrome — free
Input
Result

What it does

  • Encode or decode URL component values
  • Preserve URI separators in complete-URI mode
  • Handles spaces, Unicode, ampersands, and reserved characters
  • Shows invalid percent escapes instead of silently changing them
  • Nothing you paste is stored, even briefly

How to use URL Encoder and Decoder

  1. 1

    Choose a direction

    Select Encode when making a value safe for transport, or Decode when reading a percent-encoded value copied from a request or log.

  2. 2

    Pick the scope

    Use Component value for one parameter such as a search term. Use Complete URI when the input is an entire address and its separators should remain readable.

  3. 3

    Paste the value

    Paste a URL, query value, or text into the input box. The result updates immediately as you type and errors remain visible rather than being swallowed.

  4. 4

    Copy the result

    Copy the transformed value into your request, browser address bar, test fixture, or debugging note.

How it works

JavaScript has two pairs of standard URL functions, and the distinction is important. The component pair treats the input as one value. It escapes every character that could be mistaken for URL structure, including the ampersand between parameters, the equals sign between a key and value, and the slash between path segments. This is the right operation before inserting a user value into a query string.

The URI pair treats the input as an address that already has structure. It preserves the characters that identify the scheme, host, path, and query separators while escaping spaces and characters that cannot appear literally. The tool does not guess which mode you intended because that guess is how a valid URL becomes a different request.

Decoding reverses the relevant operation. Invalid escapes are reported by the native function and shown in the interface. That matters when debugging a request copied from a log: silently replacing malformed bytes could make the displayed request differ from what the server actually saw.

When you'd use this

Use component encoding when building a search URL, redirect parameter, callback URL, or test fixture from separate values. A phrase such as red shoes & boots must not contribute an accidental second query parameter. Use complete-URI encoding when a whole address needs to be made safe for transport while keeping its slashes and question mark recognizable.

Use decoding when reading browser history, webhook payloads, server logs, or an API request captured in a debugging tool. The readable value is useful for checking whether a space, Unicode symbol, or reserved punctuation survived a round trip. The output is a transformed string, not a validated or reachable website, so still inspect the destination before opening it.

The tool intentionally does not normalize hosts, validate schemes, or follow links. Encoding and validation are different jobs. Keeping the operation narrow makes the result predictable and avoids turning a string transformer into a network request.

The plus sign is the classic trap

%20 and + both appear as a space in URLs, and they are not interchangeable. This one difference accounts for a large share of the bugs that reach production.

+ for space comes from the application/x-www-form-urlencoded format used by HTML form submissions. It is a form-encoding rule, not a URL rule. In a URL path, + is an ordinary literal plus sign with no special meaning at all.

So a value encoded one way and decoded the other goes wrong in both directions. Encode a+b — say a search for a formula, or a phone number in international format — with component encoding and you get a%2Bb, which is correct and safe. Let it through unencoded and a server treating the query as form data reads it as a b, silently turning a plus into a space.

The reverse is worse and more common: an email address like [email protected]. Those tagged addresses are widely used for filtering, and they break constantly, because the plus survives into a query string and something downstream decodes it as a space. The address becomes user [email protected] and the mail bounces.

The rule that avoids all of it: always percent-encode the value, never rely on +. %2B for a literal plus and %20 for a space are unambiguous everywhere — in paths, in query strings, and in form bodies.

Encoding twice is a real bug, and it is visible

Double encoding happens when a value that is already encoded gets encoded again, and its signature is easy to recognize once you have seen it.

The percent sign is itself a character that needs escaping, so %20 encoded a second time becomes %2520 — the % turned into %25 and the 20 stayed. Any %25 in a URL where you did not intend a literal percent sign means an extra pass happened somewhere.

It usually comes from a value crossing layers, each of which believes it is responsible for encoding: a template helper encodes it, then the HTTP client encodes the whole URL again. The result is a request for a path containing a literal %20 rather than a space, and the server answers 404 for a resource that exists.

Decoding here is the quickest diagnosis. Paste the failing URL, decode once, and look: if the result still contains percent escapes, it was double-encoded. Decode again to see the value that was originally meant.

The fix is to decide which layer owns encoding and remove it from the others. Encoding is not idempotent, so "encode again to be safe" is never safe.

Examples

Encode a search parameter

green tea & lemon
green%20tea%20%26%20lemon

An ampersand has meaning inside a query string, so it must be encoded when it belongs to the value itself. Otherwise a server may interpret lemon as a second parameter.

Decode an API request value

q=summer%20%E2%98%95
q=summer ☕

Decoding makes the request readable without changing the value. The component mode treats the whole pasted string as one value, including the equals sign.

Frequently asked questions

What is the difference between encodeURIComponent and encodeURI?

Component mode behaves like encodeURIComponent: it escapes separators such as ampersands, equals signs, question marks, and slashes because they may be part of one value. Complete URI mode behaves like encodeURI and leaves address structure intact. Use component mode for a parameter value and URI mode for an already assembled address.

Is URL encoding the same as encryption?

No. Percent encoding changes characters into a transport-safe representation; anyone who sees the result can decode it immediately. It is appropriate for spaces, Unicode, and reserved punctuation in an address, but it does not protect passwords, API keys, or personal data. Use HTTPS and proper authentication for confidentiality.

Why does decoding sometimes show an error?

A percent-encoded byte must use a percent sign followed by exactly two hexadecimal characters, and a multi-byte Unicode value must form valid UTF-8. An incomplete escape such as percent-2 or a copied string with a missing byte cannot be decoded unambiguously. The error is safer than inventing replacement characters.

Is my URL kept anywhere?

No. The standard encodeURI, encodeURIComponent, decodeURI, and decodeURIComponent functions run on this site's own server, so the value is sent over an encrypted connection to be transformed — but nothing is written to disk, logged, or retrievable afterward. It exists only for the moment it takes to produce the result, then the request ends and it is gone.