Text & Developer tool

URL Encoder and Decoder Online

Percent-encode text for a URL, or decode it back to readable text.

  • Instant results
  • Working shown
  • No sign-up
  • Runs in your browser
ToolUpdates as you type

Encodes everything except letters, digits and - _ . ! ~ * ' ( ). Use it for one search term or query value.

How it works

This URL encoder turns spaces, symbols and non-English letters into percent codes such as %20, so text can travel safely inside a web address. The decoder turns those codes back into readable text. Choose whether you are encoding one value or a whole URL, and optionally use + for spaces as HTML forms do.

This URL encoder and decoder online converts text to percent encoding and back. Encoding turns characters that are not safe in a web address, such as spaces, & and Telugu or Hindi letters, into codes like %20. Decoding turns those codes back into readable text.

How to encode or decode a URL online

  1. Choose Encode or Decode.
  2. Paste your text or URL.
  3. When encoding, choose A value or part for one search term or form field, or A full URL for a complete address.
  4. Tick the + option if you are working with HTML form data.
  5. Copy the result. Swap sends it back as input in the other direction.

Why URL encoding is needed

A URL can only use a small set of characters: English letters, digits and a few symbols. Some symbols also have a job:

Character Job in a URL
/ Separates folders in the path
? Starts the query string
& Separates query parameters
= Joins a parameter name to its value
# Starts the fragment (a spot on the page)

Suppose you search for "java course & fees?". Put it straight into ?q=java course & fees? and the server sees q=java course, then a second, broken parameter. Encoded, the value is java%20course%20%26%20fees%3F, and the server reads the whole phrase as one value.

This is called percent encoding: each unsafe byte becomes % followed by its two-digit hex code.

Common percent codes

Character Encoded
space %20 (or + in form data)
& %26
= %3D
? %3F
/ %2F
# %23
+ %2B
% %25
₹ %E2%82%B9

Non-English characters are first turned into UTF-8 bytes, and each byte is encoded. That is why ₹ becomes three codes. To see the hex values for yourself, try the number system converter.

A value or a full URL?

Input A value or part (encodeURIComponent) A full URL (encodeURI)
a/b?c=d#e a%2Fb%3Fc%3Dd%23e a/b?c=d#e
C++ course C%2B%2B%20course C++%20course

Use a value or part for anything you put after = in a query string. Use a full URL only when you have a whole address with spaces or non-English letters in it, and its / ? & = should keep their jobs.

Common mistake: A common mistake is encoding a value twice. If %20 is encoded again, the % becomes %25 and you get %2520, which shows up as "%20" on the other side instead of a space. Encode each value once, just before you add it to the URL.

URL encoding in code

Language Encode a value Decode
JavaScript encodeURIComponent("java course") decodeURIComponent("java%20course")
Python urllib.parse.quote("java course") urllib.parse.unquote("java%20course")
Java URLEncoder.encode("java course", StandardCharsets.UTF_8) URLDecoder.decode("java+course", StandardCharsets.UTF_8)

Java's URLEncoder follows HTML form rules, so it writes spaces as +, not %20.

URLs carry the data for most web APIs. To learn how requests and query strings work, read what an API is and what a REST API is.

Pro tip: Need to share a long link on a poster or slide? Encode it here if it has spaces, then turn it into a scannable code with the QR code generator.

Frequently asked questions

Why do URLs need encoding?
A URL may only contain a limited set of characters, and some of them, like ? & = / and #, have special jobs. Encoding replaces other characters, and special characters used as plain data, with a % sign and a hex code so the address is not misread.
What does %20 mean in a URL?
%20 is a space. 20 is the hex code of the space character. Other common ones are %2F for /, %3F for ?, %26 for & and %25 for the % sign itself.
What is the difference between encodeURI and encodeURIComponent?
encodeURIComponent encodes everything except letters, digits and a few marks, so it is right for one value inside a URL. encodeURI leaves : / ? # & = alone so a full address keeps working. Use encodeURIComponent for search terms and form values.
Why does decoding fail with an error?
A % sign must be followed by two hex digits. Text like 100% is not valid encoded text. The tool shows where the problem is. A real % sign should be written as %25.
Should a space be %20 or +?
In the path of a URL, a space is %20. In the query string sent by an HTML form, browsers write spaces as +. Both are common, which is why this tool has an option for +.

Try another tool

See all free tools
Chat with us