URL Encoder / Decoder

Encode or decode URLs and URL components instantly in your browser. Supports three encoding modes — all processing is local, no data is sent anywhere.

Encoding Mode

Encodes all characters except: A–Z a–z 0–9 - _ . ! ~ * ' ( ). Use this for query string values and path segments.

Input
Try an example: query string value full URL with params already-encoded string
Output
Character Encoding Reference
Character Encoded as Component mode Full URL mode
Space%20 (or + in form mode)EncodedEncoded
!-Safe (kept)Safe (kept)
#%23EncodedSafe (kept)
$%24EncodedSafe (kept)
&%26EncodedSafe (kept)
=%3DEncodedSafe (kept)
?%3FEncodedSafe (kept)
/%2FEncodedSafe (kept)
:%3AEncodedSafe (kept)
@%40EncodedSafe (kept)
+%2BEncodedEncoded
Non-ASCII (e.g. 中文)%E4%B8%AD...Encoded (UTF-8)Encoded (UTF-8)

How to Use

  1. Choose an encoding mode: URI Component (default) encodes query string values and path segments; Full URL encodes a complete URL while preserving structural characters like /, ?, =, and #; Form Encoding replaces spaces with + for HTML form submissions.
  2. Paste your text into the Input area — either plain text to encode or a percent-encoded string to decode.
  3. Click Encode → to convert the input to percent-encoded form, or click ← Decode to reverse a percent-encoded string back to plain text.
  4. Click Copy to copy the result to your clipboard. Use Swap to move the output back to the input for chaining encode/decode operations.

About URL Encoding (Percent Encoding)

URL encoding — officially called percent encoding — is a mechanism for representing arbitrary data in a URI (Uniform Resource Identifier). URLs can only contain a limited set of ASCII characters. Characters outside this safe set must be encoded as a percent sign followed by two hexadecimal digits representing the character’s byte value in UTF-8.

For example, a space (ASCII 0x20) becomes %20, and the ampersand & (which is a reserved query-string delimiter) becomes %26. Without encoding, an ampersand in a query value would be misinterpreted as a parameter separator, silently breaking the URL.

The two main JavaScript functions for URL encoding serve different purposes:

Frequently Asked Questions

What is the difference between %20 and + for spaces?

%20 is the standard percent-encoding for a space and is valid in any part of a URL. The + notation for spaces only applies in the application/x-www-form-urlencoded format used by HTML forms — it is not valid in URL paths or most API contexts. When building query strings for REST APIs, always use %20 or encodeURIComponent(). The + shorthand is only safe when the receiving server explicitly decodes it as a space, which is guaranteed for HTML form submissions but not for general URLs.

When should I use encodeURIComponent vs encodeURI?

Use encodeURIComponent() for encoding individual values that will be placed inside a URL — for example, the value of a query parameter like ?q=hello+world&name=John Doe. Each value should be encoded separately before concatenating. Use encodeURI() only when you have a complete URL with structural characters already in place and you only want to sanitise non-ASCII characters. A common mistake is using encodeURI() on a query value: it will not encode &, =, or ?, which will break the URL structure.

Why does double-encoding happen and how do I avoid it?

Double-encoding occurs when an already-encoded string (hello%20world) is encoded again, producing hello%2520world — the % itself gets encoded to %25. This usually happens when encoding is applied multiple times in a processing pipeline. To avoid it, always decode before encoding, or check whether the string is already encoded by looking for %XX patterns. The Decode button in this tool will reverse one layer of encoding; apply it again if you suspect multiple layers.

Why does encoding non-ASCII text produce multiple %XX sequences?

Characters outside the ASCII range (like accented letters, CJK characters, or emoji) are first converted to their UTF-8 byte representation, and each byte is then percent-encoded separately. For example, the Chinese character has the UTF-8 bytes E4 B8 AD, so it encodes as %E4%B8%AD. Three percent-encoded values for one character is normal for Unicode content. Servers and browsers that understand UTF-8 will correctly decode this back to the original character.

Related Tools