Pack Camo

URL Encode & Decode

Percent-encode and decode URLs and query strings, and split a URL into parts. Усе виконується локально — нічого не надсилається на сервер.

Вхід
Text · URL
Вихід
Encoded · decoded · parsed parameters

For one value or path segment: & = ? / # are encoded.

Text

pane.characters

Encoded

pane.characters

Caf%C3%A9%20%26%20cr%C3%A8me%3F%2050%25%20off%20%2F%20today%20only%20%23deal

URL encoding and decoding, and a parser for the whole URL

This URL encoder and decoder converts text to and from percent-encoding as you type, in the three flavours the web actually uses. The decoder copes with the broken input real logs are full of — a stray % or a cut-off UTF-8 sequence — and tells you exactly where it is. A URL parser splits any address into its parts and lets you edit the query string as a table. Everything runs locally in your browser.

How to URL encode or decode

  1. Choose Encode, Decode or Parse URL.
  2. When encoding, pick the method: Component for a single query value or path segment, Full URL to tidy an address without breaking it, or Form to match what an HTML form submits.
  3. When decoding, decide whether + means a space. It does in query strings and form bodies; it does not in paths.
  4. Copy the result, or swap it back into the input to check the round trip. In Parse URL, edit, add or remove query parameters and the URL is rebuilt for you.

What percent-encoding does

A URL may only contain a limited set of ASCII characters, and several of them have a job: / separates path segments, ? starts the query, & and = separate parameters and # starts the fragment. Any other character, or a reserved one used as data, is written as % followed by two hex digits for each of its UTF-8 bytes. A space becomes %20, & becomes %26, and é, two bytes in UTF-8, becomes %C3%A9.

Getting this wrong is a classic bug: a search for "salt & pepper" that arrives as just "salt ", because the unencoded & started a new parameter.

encodeURIComponent, encodeURI or form encoding?

Component (encodeURIComponent)
Encodes everything except letters, digits and - _ . ! ~ * ' ( ). Use it for one piece of a URL: a query value, a path segment, a redirect URL passed as a parameter. This is the right choice nine times out of ten.
Full URL (encodeURI)
Leaves the characters that give a URL its structure (: / ? # & = and so on) alone and encodes the rest, such as spaces and non-ASCII letters. Use it on a complete address you want to make valid, never on a single value — it will not encode & or = inside it.
Form (application/x-www-form-urlencoded)
What browsers send when a form is submitted and what URLSearchParams produces: spaces become +, and only letters, digits and * - . _ stay as they are.

Decoding, + signs and malformed sequences

The + character means a space only in the query string and in form bodies; in a path it is a literal plus. That is why decoding has a + as space switch rather than guessing. If a decoded value shows plus signs where spaces should be, turn it on.

JavaScript's decodeURIComponent throws "URI malformed" at the first % that is not followed by two hex digits — "100%" is enough — or at a byte sequence that is not valid UTF-8, such as text that was percent-encoded as Latin-1 (%E9 for é). This decoder keeps going instead: it decodes everything that is valid, leaves the broken parts as they were, and lists each one with its line and column so you can find it in a long log line.

Reading and editing a URL

The parser shows the protocol, credentials, host, port, path, query and fragment of any absolute URL, decoded so they are readable. Query parameters appear as a key/value table: change a value, add a parameter or delete one, and the full URL is rebuilt with correct encoding. It is a quick way to strip tracking parameters such as utm_source, or to see what a long redirect link really points to.

For other encodings, see the Base64 encoder and the HTML entity encoder, which escapes text for HTML rather than for URLs.

Поширені запитання

What is URL encoding?
URL encoding, or percent-encoding, replaces characters that are not allowed or have a special meaning in a URL with % followed by the hex value of each of their UTF-8 bytes. A space becomes %20 and & becomes %26.
Should a space be encoded as %20 or +?
Both are correct in different places. %20 works everywhere. + means a space only in query strings and form submissions, which is what form encoding produces; in a path a + is a literal plus sign.
What is the difference between encodeURI and encodeURIComponent?
encodeURIComponent encodes reserved characters such as / ? & = and #, so it is for a single value inside a URL. encodeURI leaves them alone, so it is for a complete URL whose structure must survive.
Why do I get a "URI malformed" error?
The input contains a % that is not followed by two hex digits, or percent-encoded bytes that are not valid UTF-8. This tool decodes the rest anyway and shows where each problem is.
How do I decode URL parameters?
Paste the URL into Parse URL to see every query parameter decoded in a table, or paste just the query string into Decode with + as space turned on.
Which characters do not need to be encoded in a URL?
Letters A to Z and a to z, digits, and - . _ ~ are always safe. Everything else should be encoded when it is data rather than part of the URL's structure.
Is my URL sent anywhere?
No. Encoding, decoding and parsing run in your browser, so URLs containing tokens or personal data never leave your device.