This free URL encoder and decoder converts spaces, symbols and non-English text into the %XX form that web addresses need, and back again. It can also take a long link apart so you can read every piece. It runs in your browser.
How to use the URL encoder
- Paste your text or link.
- Choose Component to encode a single value, such as a search term or one query parameter. This uses
encodeURIComponent. - Choose Full URL to encode a complete address while keeping its
:,/,?,&and#intact. This usesencodeURI. - Press Encode or Decode.
- Paste a full URL to see its parts (protocol, host, path and hash) and a table of its query parameters.
What percent-encoding does
A URL may only contain a limited set of characters. Everything else is written as its UTF-8 bytes, each shown as % plus two hex digits. A space becomes %20, & becomes %26, and the rupee sign ₹, which takes three bytes in UTF-8, becomes %E2%82%B9. Decoding simply reverses this.
You meet encoded URLs all the time: when you search for filter coffee near me, share a Google Maps link, or open a link in an email campaign with tracking codes. Pasting such a link into the URL encoder and pressing Decode turns %20 and friends back into readable text, so you can see what the link really contains before you share it.
Component or full URL?
This is the choice that causes most bugs. Characters such as &, =, ? and / have a job inside a URL. Whether they should be encoded depends on whether you are encoding one value or the whole address. MDN’s pages on encodeURIComponent() and encodeURI() list the exact characters each one leaves alone.
| Input | Component (encodeURIComponent) | Full URL (encodeURI) |
|---|---|---|
idli & vada = ₹60 | idli%20%26%20vada%20%3D%20%E2%82%B960 | Keeps & and =, which would break a query value |
https://example.com/a?b=c | https%3A%2F%2Fexample.com%2Fa%3Fb%3Dc | https://example.com/a?b=c (unchanged) |
The rule of thumb: encode each value with Component, then join the values into the URL. Use Full URL only for an address that is already correctly built but contains spaces or non-English characters. Never run Component on a whole URL, because it would encode the :// and slashes too.
const dish = 'idli & vada';
const url = 'https://example.com/menu?item=' + encodeURIComponent(dish);
console.log(url); // https://example.com/menu?item=idli%20%26%20vadaReading the parts of a URL
Long links from shopping sites and ads are hard to read. The URL encoder’s breakdown splits them up. For https://shop.example.com/search/sarees?colour=red&city=Kanchipuram&q=silk%20saree#reviews you get:
| Part | Value |
|---|---|
| Protocol | https: |
| Host | shop.example.com |
| Path | /search/sarees |
| Query parameters | colour = red, city = Kanchipuram, q = silk saree |
| Hash | #reviews |
Tip: In HTML form submissions, a space in a query value is often sent as + instead of %20. decodeURIComponent() does not turn + back into a space, but the browser’s URLSearchParams does. Our lesson on PHP forms with GET and POST shows how query strings are sent.
To learn how links and requests work, see the HTML links and JavaScript fetch lessons.
Learn more
- Base64 Encoder & Decoder
- JSON Formatter & Validator
- QR Code Generator
- HTML Links
- Fetch and Async JavaScript
- PHP Forms: GET and POST
Frequently asked questions
Why do I get an error when decoding?
A % must be followed by two hex digits that form valid UTF-8. Text like 100% or a half-copied link makes decoding fail. Check for a stray % sign or a cut-off code.
Is URL encoding the same as encryption?
No. It only changes how characters are written so they can travel in a URL. Anyone can decode it, so never put passwords in a URL.
Should I encode letters and numbers?
No. Letters A–Z and a–z, digits and a few marks such as -, _, . and ~ are always safe and stay as they are.
Is my text sent anywhere?
No. Encoding, decoding and the URL breakdown all run in your browser.