URL Encoder and Decoder – Percent-Encode and Decode URLs
Encode text so it can be safely placed in a URL, or decode a percent-encoded URL back into readable text. Choose between encoding a single query value, a whole URL or form data, and see every query parameter of a decoded URL in a table.
How to use the URL encoder and decoder
- Choose Encode or Decode.
- Paste your text or URL.
- When encoding, choose Query value, Whole URL or Form data.
- When decoding, choose whether + means a space.
If the decoded text is a URL with a query string, a table lists each parameter and its value.
Which encoding to choose
- Query value (encodeURIComponent) — for one piece of data that goes inside a URL, such as a search term:
q=café & crème→q=caf%C3%A9%20%26%20cr%C3%A8me. - Whole URL (encodeURI) — for a full URL that contains spaces or non-ASCII characters but whose structure must stay intact.
- Form data — like a query value, but spaces become +, as in HTML form submissions.
Worked example
Encoding the value a b&c=d/é as a query value gives a%20b%26c%3Dd%2F%C3%A9. Each reserved character — space, &, =, / — is replaced, and é becomes two bytes, %C3 and %A9.
Reserved and unreserved characters
URLs give some characters special jobs: ? starts the query, & separates parameters, = joins names to values, # starts a fragment and / separates path segments. If your data contains these characters, they must be encoded so they aren’t mistaken for structure. Letters, digits and - _ . ~ never need encoding.
Common uses
- Building links with search terms, email addresses or redirects in the query string.
- Reading tracking links and long marketing URLs.
- Debugging APIs where parameters arrive encoded.
- Creating mailto: links with a subject and body.
- Fixing broken links that contain spaces or special characters.
Double encoding
Double encoding usually happens when a framework encodes a value automatically and the code encodes it again by hand.
A frequent bug is encoding something twice, so a space becomes %2520 (the % itself encoded as %25). If you see %25 followed by two hex digits in a URL, the value has probably been encoded twice — decode it once more.
Encoding in code
In JavaScript, use encodeURIComponent() for values and new URLSearchParams() to build query strings — it handles encoding for you. In Python, use urllib.parse.quote() and urlencode(); in PHP, rawurlencode() and http_build_query(). Building URLs by joining strings by hand is the most common cause of broken links and security bugs, because a value containing & or # can change the meaning of the whole URL.
The decoder is also useful for reading redirect and tracking links: decode them to see where a link really goes before you click it.
Related tools
For readable URL slugs from titles, see the slug generator. To encode data in Base64, use the Base64 encoder; for HTML special characters, the HTML entity encoder.
Frequently asked questions
What is URL encoding?
Also called percent-encoding, it replaces characters that aren’t allowed or have special meaning in URLs with a % followed by two hex digits. A space becomes %20 and é becomes %C3%A9 (its two UTF-8 bytes).
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent encodes everything except letters, digits and - _ . ! ~ * ' ( ), so it is right for a single query value. encodeURI leaves characters such as : / ? & = and # alone, so it is right for a complete URL that is already structured.
Should spaces be %20 or +?
In paths and most of a URL, %20. In HTML form submissions (application/x-www-form-urlencoded) a + is used. Choose “Form data” to encode spaces as +, and tick “Treat + as a space” when decoding form data.
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 cut-off sequence such as %E0%A4 can’t be decoded.
Do I need to encode non-English characters?
Modern browsers display them, but when building URLs in code or sending them to APIs, encode them to be safe.
Is my URL sent anywhere?
No. Encoding and decoding happen in your browser.
Related tools
Base64 Encoder / Decoder
Encode and decode Base64 and Base64URL with UTF-8 support.HTML Entity Encoder
Escape and unescape HTML entities like & and é.JSON Formatter
Pretty-print, validate and minify JSON with clear error positions.JWT Decoder
Read a JWT’s header, payload and expiry — privately.Slug Generator
Turn titles into clean, lowercase URL slugs with no accents.
Last updated: