URL Encoder & Decoder

Percent-encode and decode URLs in your browser. Choose encodeURIComponent or encodeURI, handle + as space, and break any URL into its parts.

Runs in your browser

Component mode (encodeURIComponent) is the safe default; whole-URL mode keeps / ? & : @ intact.

encodeURIComponent — for one piece of a URL: a query value, a path segment, a form field. Escapes / ? : @ & = + $ , # so they can’t be mistaken for URL structure. Use this if you’re not sure.

Result

Paste a URL or a value to encode.

What percent-encoding is

A URL may only contain a small set of US-ASCII characters. RFC 3986 §2.3 calls the safe ones unreserved — A–Z, a–z, 0–9 and the four marks - . _ ~ — and everything else must be written as a percent sign followed by the two hex digits of each UTF-8 byte. A space becomes %20; "c++" becomes c%2B%2B.

Because the encoding operates on UTF-8 bytes, a non-ASCII character costs several escapes: "한" is three bytes and becomes %ED%95%9C, and "안녕하세요" becomes %EC%95%88%EB%85%95%ED%95%98%EC%84%B8%EC%9A%94. Fifteen escapes for five syllables is correct, not a bug.

The other group, the reserved characters : / ? # [ ] @ ! $ & ' ( ) * + , ; =, are legal but structural. Left alone they delimit parts of the URL; encoded, they are ordinary data. Deciding which of the two you mean is the whole job of the mode switch below.

Component or whole URL: encodeURIComponent vs encodeURI

Component mode (encodeURIComponent) escapes the structural characters as well, so the result is safe to drop into one slot of a URL: a query value, a path segment, a fragment. Whole-URL mode (encodeURI) leaves ; / ? : @ & = + $ , # untouched so an address you already assembled keeps working while its spaces and Korean text get escaped.

Using the wrong one is the single most common URL bug. Run https://example.com/a b through component mode and you get https%3A%2F%2Fexample.com%2Fa%20b — a string that is no longer a link. Run a user-supplied value through whole-URL mode and an & inside it silently splits your query into two parameters.

The tool lists which structural characters your input actually contains, so you can see what the two modes would do differently before choosing. The strict RFC 3986 option additionally escapes ! ' ( ) * , which encodeURIComponent leaves alone — required by OAuth 1.0a signatures and some S3 pre-signed URLs.

Why a space is sometimes + and sometimes %20

Two encodings share the same percent syntax. In application/x-www-form-urlencoded — what an HTML form posts and what URLSearchParams produces — a space is written as +, and a literal plus sign must therefore be escaped as %2B. In a path, a fragment or a header, a space is %20 and + means a plus.

"Treat + as space" is on by default when decoding, which matches URLSearchParams and every server-side form parser. Turn it off when the value is not form data — a base64url token, a chemical formula, a phone number in +82 form — or you will read a plus as a space that was never there.

Double encoding and how to spot it

Encoding an already-encoded value escapes its percent signs: %20 becomes %2520, and %ED%95%9C becomes %25ED%2595%259C. One decode leaves visible %20 in the output, which is the tell-tale sign. The tool detects this and offers a second pass rather than silently decoding twice, because a value that legitimately contains "%20" as text also exists.

The cause is almost always two layers encoding the same value: your code escapes a redirect target and then the HTTP client, a template engine or a proxy escapes the finished URL again. Fix it by encoding exactly once, at the point where the value is placed into the URL — not on both sides.

Taking a URL apart

The inspector parses an absolute URL with the browser’s own WHATWG URL parser and shows protocol, host, port, path, fragment and every query parameter with its raw and decoded value side by side. A parameter whose raw value cannot be decoded is flagged instead of being silently repaired — that is usually where a bug is hiding.

Two structural facts are worth remembering while reading the breakdown. The fragment after # is never sent to the server — it exists only in the browser — so tracking or state that must reach the backend cannot live there. And the host is case-insensitive while the path and query are not, so /Product and /product are different resources.

Edit any decoded value and press Apply — the URL is rebuilt with each key and value encoded exactly once, which is a safer way to change a tracking parameter than editing the escaped string by hand.

When decoding fails or the text comes back broken

A percent sign that is not followed by two hex digits is a hard error, and so is a truncated multi-byte sequence such as %ED%95 — the tool points at the exact position rather than dropping the character. Both usually mean the URL was cut short by a log line, a spreadsheet cell or a chat client.

Percent-decoding assumes UTF-8, as RFC 3986 §2.5 recommends and the WHATWG URL Standard requires. Legacy Korean pages that escaped EUC-KR bytes (%C7%D1 for "한") therefore fail here, and correctly so: those bytes are not valid UTF-8, and a decoder that guessed would hand you plausible-looking mojibake instead of an error.

Non-ASCII domain names follow a different rule entirely: they are converted to Punycode (RFC 3492), so 한국.kr travels as xn--3e0b707e.kr and is never percent-encoded. Percent escapes belong to the path, query and fragment only.

Encoding, safety and privacy

Percent-encoding makes a value structurally safe inside a URL. It does not make it safe inside HTML, SQL or a shell command — each of those needs its own escaping, and treating an encoded URL as sanitised input is how open-redirect and XSS bugs get written. Decode for inspection, escape again for the destination.

Query strings are logged everywhere — by your server, a CDN, a proxy, and in the browser’s history — so tokens and personal data do not belong in them even when correctly encoded. Conversion here happens in this tab; the URLs you paste are not sent anywhere, and your draft stays in this browser’s localStorage until you clear it.

How to use

  1. Choose Encode or Decode, then paste your URL or value into the input box.
  2. When encoding, pick ‘Component (encodeURIComponent)’ for one value or ‘Whole URL (encodeURI)’.
  3. Tick ‘Treat + as space’ when decoding form data, or ‘Process each line separately’ for lists.
  4. In the URL inspector, check protocol, host and path, edit a value and press ‘Apply edits’.
  5. Copy the result, or press ⇄ Swap to move it into the input and flip the direction.

FAQ

What is the difference between encodeURIComponent and encodeURI?

encodeURIComponent escapes the structural characters / ? : @ & = + $ , #, so use it for one piece of a URL such as a query value. encodeURI leaves those alone so a whole URL still works. Encoding a full URL with the component function is the most common URL-encoding mistake — that is why we make you pick.

Why does my decoded text have + signs instead of spaces?

HTML forms encode a space as + in query strings, while %20 is used elsewhere. Our "Treat + as space" option is on by default and matches URLSearchParams. Turn it off if a literal + in your data matters.

What does "double-encoded" mean?

The value was percent-encoded twice, so %20 became %2520. Decoding once still leaves %20 behind. We detect this and offer a second decode. It usually means a value was encoded by both your code and a framework.

Why is my Korean text one long string of %XX?

Because percent-encoding works on UTF-8 bytes, and each Korean syllable is three of them. "한" is %ED%95%9C and a five-syllable word produces fifteen escapes. That is the correct wire form — browsers and servers decode it back to the original text, and the address bar usually displays the decoded version even though the request carries the escaped one.

Can I decode several URLs at once?

Yes — paste one per line and tick "Process each line separately". Each line is converted on its own, so a broken escape in line 7 is reported with its position instead of failing the whole batch. It is the quickest way to read a column of URLs copied out of a log or a spreadsheet.

Related tools

More Developer tools: Developer

Send feedback

Found a bug or have an idea? Tell us — it helps make the tools better.

Only needed if you would like a reply.

Page: /developer/url-encoder/