URL Encoder & Decoder
Percent-encode and decode URLs, query strings and parameters, in your browser.
URL Encoder and Decoder - Percent-Encode Text and Query Strings Online
A URL may only contain a limited set of characters. Everything else - spaces, accents, ampersands, slashes inside a value, emoji, Arabic or Japanese text - has to be percent-encoded before it can travel safely in a link, a query string or a form submission. This free URL encoder and decoder does that conversion instantly, in both directions, without sending anything to a server.
Paste your text and click Encode to get a safe, transport-ready string, or paste an encoded URL and click Decode to read it in plain language. A mode selector lets you switch between encodeURIComponent and encodeURI, which is the choice that decides whether your link works or silently breaks.
What is URL encoding?
URL encoding, also called percent-encoding, replaces an unsafe character with a percent sign followed by its hexadecimal byte value. A space becomes %20, a slash becomes %2F, a question mark becomes %3F. Characters outside ASCII are first converted to UTF-8 bytes and then encoded byte by byte, which is why a single accented letter often turns into two percent groups and an emoji into four.
encodeURIComponent or encodeURI - which mode do you need?
| Situation | Mode | Why |
|---|---|---|
| Encoding one query parameter value | encodeURIComponent | Escapes &, =, ?, / and # so the value cannot break out of its field |
| Encoding a path segment such as a slug | encodeURIComponent | Keeps a slash inside the value from creating a new path level |
| Cleaning up a complete URL you already have | encodeURI | Leaves the structural characters intact so the address stays a working URL |
| Building a redirect target passed inside another URL | encodeURIComponent | The whole inner URL is a value, not a structure |
How to encode or decode a URL
- Paste the text, parameter value or full URL into the input pane.
- Choose
encodeURIComponentfor a single value, orencodeURIfor a whole address. - Click Encode to percent-encode, or Decode to reverse it.
- Copy the output straight into your code, your browser bar or your API client.
Characters you will see most often
%20- space. In older form submissions you will also see+used for the same purpose.%2F- forward slash, encoded when it belongs to a value rather than to the path.%3Fand%26- question mark and ampersand, the two characters that delimit query parameters.%3D- equals sign, which separates a parameter name from its value.%23- hash, otherwise read as the start of a fragment identifier.%2B- plus sign, which must be encoded or it may be interpreted as a space.
When you need a URL encoder
- Building search, filter or pagination links where user input ends up in the query string.
- Passing a return URL to an OAuth provider or a payment gateway as a
redirect_uri. - Adding UTM campaign parameters that contain spaces or punctuation.
- Reading a long tracking link from an email and decoding it to see where it actually points.
- Debugging an API call where a parameter contains JSON, a timestamp or a signature.
- Handling non-Latin slugs so a Persian, Japanese or Cyrillic title survives a copy-paste.
Mistakes that break links
- Double encoding. Running an already encoded string through again turns
%20into%2520. Decode first, then encode once. - Encoding the whole URL with encodeURIComponent. The
://and the slashes get escaped and the address stops being a URL. - Confusing + and %20. Inside a query string a plus may mean a space; inside a path it means a literal plus.
- Forgetting UTF-8. Legacy pages that encoded in ISO-8859-1 produce percent groups that a modern decoder cannot map back.
- Trusting a decoded value. Decoding is not sanitising - validate input before using it in a query or in HTML.
Runs entirely in your browser
The encoder uses the browser's own JavaScript functions, so nothing is uploaded, stored or logged. That keeps signed URLs, session identifiers and customer parameters where they belong: on your machine.
URL encode in JavaScript, Python, PHP, Java and C#
| Language | Encode a value | Notes |
|---|---|---|
| JavaScript | encodeURIComponent(value) | encodeURI for a whole address |
| Python | urllib.parse.quote(value, safe='') | quote_plus turns spaces into + |
| PHP | rawurlencode($value) | urlencode uses + for spaces |
| Java | URLEncoder.encode(value, "UTF-8") | Produces + for spaces; replace with %20 inside a path |
| C# / .NET | Uri.EscapeDataString(value) | HttpUtility.UrlEncode uses + |
| PowerShell | [uri]::EscapeDataString($value) | Same rules as .NET |
Related tools
URLs and payloads travel together. Decode embedded binary with the Base64 encoder, read a token from a callback URL with the JWT decoder, format an API response with the JSON formatter, and test a matching pattern with the regex tester.