Free online tools
English EN, Choose a language

URL encoder and decoder

Encode text for a URL, decode percent-encoded text, or split a query string into its parameters, as you type.

Action

What are you encoding?

Result

Type or paste text and the result appears here.

Runs in your browser. Your text is never uploaded or stored.

How to URL encode and decode

  1. Choose Encode, Decode or Parse query string. The result appears as you type.
  2. When encoding, say what you are encoding: a value (a piece that goes after q=, so even / ? & = # are escaped) or a whole URL (those characters are kept because they structure the URL).
  3. Tick Spaces as + for HTML form style. Copy or download the result.

Example: encoding the value coffee & tea = 5% gives coffee%20%26%20tea%20%3D%205%25, and decoding that returns coffee & tea = 5%.

Component or whole URL?

This is the choice that most often goes wrong. The same address, two ways:

SettingResult
Whole URL (encodeURI)https://example.com/a%20b/caf%C3%A9?q=1%202&r=%C3%BC
A value (encodeURIComponent)https%3A%2F%2Fexample.com%2Fa%20b%2Fcaf%C3%A9%3Fq%3D1%202%26r%3D%C3%BC

The first is still a working address: only the space, the accented letters and the other unsafe characters are escaped. The second escapes the colon, the slashes and the ? and & too, so it is a mangled URL but a safe parameter value. Rule: encode each value with the component setting and then put the pieces into the URL; never encode a finished URL as a component.

Which characters are escaped

URLs may contain only letters, digits and a few symbols without escaping. Everything else becomes % plus two hexadecimal digits for each byte of its UTF-8 form, so one non-Latin character can become several escapes: 日本 is %E6%97%A5%E6%9C%AC.

CharacterEncodedWhy
space%20 (or + in forms)not allowed in a URL
&%26separates query parameters
=%3Dseparates a key from its value
?%3Fstarts the query string
#%23starts the fragment
/%2Fseparates path segments
%%25starts an escape, so it must be escaped itself
+%2Bmeans a space in forms

Never escaped by the component setting: A-Z a-z 0-9 - _ . ! ~ * ' ( ). The rules are in RFC 3986. With Spaces as + on, a b becomes a+b, the old application/x-www-form-urlencoded style that HTML forms use.

Read a query string as a table

Paste a URL, or just the part after the ?, and choose Parse query string. Every parameter is decoded and numbered, which is the quickest way to read a long tracking or search link:

https://shop.example/list?tag=red+shoes&tag=blue&size=9%2F10&q=caf%C3%A9&empty=
1. tag = red shoes
2. tag = blue
3. size = 9/10
4. q = café
5. empty = 

Keys that appear more than once (here tag) are counted in the stats; most servers keep all of them as a list. A parameter with no value, like empty=, shows an empty value. In this mode a plus sign is read as a space, as forms do.

Decoding errors

Decoding fails when a % is not followed by two hex digits, or when the escapes do not form valid UTF-8 text. For 100% the tool says: Cannot decode: "%" at position 4 is not followed by two hex digits. The fix is usually that the text was never encoded (a literal percent sign) or was cut off in the middle of a sequence. Decoding is not "undo for any text": do not decode twice, because a text that contains a real %25 would turn into a bare %.

For other encodings used in the same places see Base64 (data in headers and tokens) and the slug maker (readable URL paths without any escapes).

Related tools

URL encoder and decoder FAQ

How do I URL encode a string?

Choose Encode, pick whether it is a value or a whole URL, and type or paste the text. Spaces, symbols and non-Latin characters become %XX sequences.

How do I decode a URL?

Choose Decode and paste the percent-encoded text. %20 becomes a space and %C3%A9 becomes é. Tick Spaces as + if the text comes from an HTML form.

What is the difference between encodeURI and encodeURIComponent?

encodeURI keeps characters that structure a URL (/ ? & = #). encodeURIComponent escapes them too, so use it for a single value inside a URL, not for the whole address.

Why is a space %20 in one place and + in another?

%20 is the standard escape for a space in any part of a URL. + means a space only in form-encoded query strings. When unsure use %20.

Can it handle emoji and non-Latin text?

Yes. Text is converted to UTF-8 and each byte becomes a %XX escape, and decoding reverses it.

Why does decoding say a % is not followed by two hex digits?

A % starts an escape and must be followed by two hexadecimal digits. A literal percent sign in the text, or text cut in the middle of an escape, causes this.

Is my text sent anywhere?

No. Encoding and decoding run in your browser and nothing is uploaded or stored.

Missing something in the URL encoder and decoder?Suggest an idea. It takes 20 seconds and we read every one.Suggest an idea

Sends only what you type here, never the text you work with. Your email is used only to reply about this idea.

Free online tools