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
- Choose Encode or Decode.
- Paste your text or URL.
- When encoding, choose A value or part for one search term or form field, or A full URL for a complete address.
- Tick the + option if you are working with HTML form data.
- 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
%20is encoded again, the % becomes%25and 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.
