URL Encoder & Decoder

// encode special characters in urls · decode percent-encoded strings · parse url components · nothing leaves your browser

encodeURIComponent — encodes all special characters except A–Z a–z 0–9 - _ . ! ~ * ' ( ). Use for encoding individual query parameter values.
waiting for input
raw input
encoded output
common encodings — click to copy

What is URL encoding?

URL encoding (also called percent-encoding) converts characters that aren't allowed in URLs into a safe format. Each character is replaced with a % followed by its two-digit hexadecimal ASCII code — for example, a space becomes %20.

This is essential when passing special characters like &, =, ?, or non-ASCII text (like Arabic or Chinese characters) in query strings or path segments.

How to use this tool

  • Use Encode to convert raw text into a URL-safe string
  • Use Decode to convert a percent-encoded URL back to readable text
  • Use Parse URL to break a full URL into its components
  • Choose encodeURIComponent for query values, encodeURI for full URLs
  • Click any character in the reference table to copy its encoded form

Understanding URL encoding

URLs can only contain a limited set of characters defined by the URI specification (RFC 3986). Characters outside this set — including spaces, international characters, and many punctuation marks — must be percent-encoded before they can appear in a URL. Percent-encoding replaces each unsafe byte with a percent sign followed by two hexadecimal digits representing the byte value.

For example, a space becomes %20, an ampersand becomes %26, and the equals sign becomes %3D. Non-ASCII characters like Arabic, Chinese, or accented Latin letters are first encoded as UTF-8 bytes, then each byte is percent-encoded — which is why a single character like é becomes %C3%A9 (two bytes in UTF-8).

URL encoding is essential when building query strings, constructing API requests programmatically, handling form submissions, and working with any user-generated content that might contain special characters. Failure to encode URLs properly is one of the most common sources of bugs in web applications.

encodeURIComponent vs encodeURI

encodeURIComponent is for encoding individual query parameter values. It encodes everything except letters, digits, and the characters - _ . ! ~ * ' ( ). Use this when encoding the value part of a key=value pair in a query string.

encodeURI is for encoding a complete URL. It leaves characters that have structural meaning in URLs untouched: / ? # & = : @ !. Use this when you have a full URL that might contain Unicode characters but its structural components are already correct.

Frequently Asked Questions

What's the difference between encodeURI and encodeURIComponent?+
encodeURI is for encoding a complete URL — it leaves characters like /, ?, #, and & alone because they have structural meaning in a URL. encodeURIComponent encodes everything except letters, digits, and - _ . ! ~ * ' ( ) — use it for individual query parameter values.
Why is a space encoded as %20 and sometimes as +?+
In standard URL percent-encoding, a space is %20. In HTML form data (application/x-www-form-urlencoded), spaces are encoded as +. Both are valid in their respective contexts — this tool supports both via the encoding type selector.
Why do I see %C3%A9 for a single character?+
Non-ASCII characters (like accented letters or Arabic/Chinese text) are first encoded as UTF-8, which may produce multiple bytes per character. Each byte becomes a separate %XX sequence. For example, é is encoded as %C3%A9 because it's two bytes in UTF-8.
What characters are safe in a URL without encoding?+
Unreserved characters that never need encoding: uppercase and lowercase letters (A–Z, a–z), digits (0–9), and the symbols - _ . ~. Everything else should be percent-encoded depending on context.
How do I encode a full URL with query parameters?+
Encode each query parameter value individually using encodeURIComponent, then join them with & and append to the base URL. Don't encode the full URL at once — that would encode the ? and = separators, breaking the URL structure.