Skip to tool

URL Encoder & Decoder

Raw
0 chars · 0 bytes
Encoded
0 chars

The encoded text

Repeat decoding until the text stops changing.

encodeURI vs encodeURIComponent vs RFC 3986

Percent-encoding writes each byte of a character's UTF-8 form as % plus two hex digits: a space becomes %20, é becomes %C3%A9 and 中 becomes %E4%B8%AD. The three strategies differ in which ASCII characters they leave as they are. encodeURI keeps the characters that give a URL its structure, such as : / ? # & = + @, so use it on a whole URL. encodeURIComponent keeps only A–Z a–z 0–9 - _ . ~ ! * ' ( ), so use it on one query value or path segment. RFC 3986 unreserved keeps only A–Z a–z 0–9 - _ . ~ and also encodes ! * ' ( ), as OAuth 1.0 and AWS Signature V4 signing require.

Punycode and internationalized domains (xn--)

DNS carries only ASCII, so each domain label that contains other characters is lowercased, converted with the RFC 3492 Punycode algorithm and prefixed with xn--. münchen.de becomes xn--mnchen-3ya.de and example.中国 becomes example.xn--fiqs8s; ASCII labels are only lowercased. The Punycode IDN tab converts in both directions and warns when a label exceeds the 63-byte DNS limit. It does not apply the full IDNA mapping rules, so input such as full-width letters can convert differently from a browser; the Full URL tab uses the browser's own parser.

+ or %20 for spaces

In a URL path a space must be %20. The application/x-www-form-urlencoded format, used by HTML form submissions and URLSearchParams, writes a space as + instead, so a literal + must become %2B. Select Space → + to encode in form style: spaces become + and + becomes %2B. In that mode, decoding also turns + back into a space; with Space → %20, a + is left as a plus sign.

Decoding a URL that was encoded more than once

Redirect and tracking links often encode a URL again each time it is wrapped, so a space becomes %20, then %2520, then %252520. Turn on Recursive decode to repeat decoding until the text stops changing, up to 16 rounds. The Encoded pane shows how many rounds were used. If percent sequences remain after 16 rounds, the tool reports the recursion limit.

Editing query strings and full URLs

The Query tab splits a string such as ?a=1&b=hello%20world&tag=js&tag=ts into decoded key–value rows. A leading ? is removed, anything after # is dropped, and repeated keys stay as separate rows. Edit, add or delete rows and the query is rebuilt with encodeURIComponent, using + or %20 for spaces. The Full URL tab turns a readable address such as https://münchen.de/straße?q=über into the form a browser sends, https://xn--mnchen-3ya.de/stra%C3%9Fe?q=%C3%BCber, and converts it back.

How to encode or decode a URL

  1. Paste the text: Type or paste plain text into Raw to encode it, or an encoded string into Encoded to decode it.
  2. Pick the encoding strategy: Choose encodeURI for a whole URL, encodeURIComponent for one value, or RFC 3986 unreserved for signing, and pick %20 or + for spaces.
  3. Copy the result: Use the copy button in the header of the Raw or Encoded pane.

FAQ

What is the difference between encodeURI and encodeURIComponent?

encodeURI leaves : / ? # & = + and the other URL delimiters unchanged, so it is for a whole URL. encodeURIComponent encodes them, so it is for one value inside a URL. Encoding https://a.com/?q=1 with encodeURIComponent gives https%3A%2F%2Fa.com%2F%3Fq%3D1, which is right only when the whole URL is itself a parameter value, such as a redirect target.

Why does my URL contain xn--?

The domain contains non-ASCII characters, such as accented letters or Chinese, and DNS carries only ASCII. Each such label is converted with Punycode and given the xn-- prefix: xn--mnchen-3ya is münchen and xn--fiqs8s is 中国. Paste the domain into the ACE pane of the Punycode IDN tab to read it.

When should I use + instead of %20 for spaces?

Use + only when the receiver parses the text as application/x-www-form-urlencoded, such as an HTML form POST body or URLSearchParams output. Use %20 in paths. Many servers read + as a space in query strings, but in a path, or for a strict RFC 3986 parser, + is a literal plus sign.

What do %20 and %E4%B8%AD mean in a URL?

They are percent-encoded bytes. %20 is byte 0x20, a space. %E4%B8%AD is the three UTF-8 bytes of the Chinese character 中. Paste the string into the Encoded pane to see the original text.

Why does decoding show an error?

"Invalid hex" means a % is not followed by two hex digits, as in 100% off; a literal percent sign must be written %25. "Invalid UTF-8 byte sequence" usually means the text was encoded in another character set. For example, %D6%D0 is 中 in GBK; this tool decodes UTF-8 only.