URL Encoder / Decoder

Encode and decode URLs with percent-encoding. Handles special characters, spaces, symbols and Unicode for API requests and query strings.

URL Encoder / Decoder

Invalid encoded text — check the input and try again.

What is URL encoding?

URL encoding (also called percent-encoding) converts characters that cannot appear in a URL into a safe format: a % sign followed by two hexadecimal digits. For example, a space becomes %20, an ampersand becomes %26, and a plus sign becomes %2B. This ensures that URLs are correctly interpreted by browsers and servers regardless of the characters they contain.

When do you need to URL encode?

URL encoding is required whenever a URL contains characters outside the standard ASCII set or characters that have a reserved meaning in URLs. Common scenarios include: building query strings (?q=hello%20world), passing file paths as parameters, sending special characters in form data, and constructing API requests programmatically.

encodeURIComponent vs encodeURI

JavaScript provides two encoding functions. encodeURI encodes a complete URL, preserving characters like /, ?, #, : and = that have structural meaning in a URL. encodeURIComponent encodes a URL component (such as a query parameter value) and converts all reserved characters too. This tool uses encodeURIComponent, which is the right choice when encoding individual values that will be embedded inside a larger URL.

Frequently asked questions

What is URL encoding?

URL encoding converts characters not allowed in a URL into a %XX format where XX is the hex value of the character. A space becomes %20, / becomes %2F, etc. It ensures URLs are transmitted correctly over the internet.

When should I URL encode?

Encode any special characters when including them in query parameters, API endpoints, or form action URLs. If you're building a URL dynamically in code, always encode the parameter values — never the full URL structure.

What does %20 mean in a URL?

%20 is the percent-encoded representation of a space character. Similarly, %2F = /, %3F = ?, %3D = =, %26 = &.

What is the difference between encodeURI and encodeURIComponent?

encodeURI preserves URL structure characters (/, ?, #, :). encodeURIComponent encodes everything, including those characters. Use encodeURIComponent for individual parameter values, and encodeURI only for full URLs.

Step-by-step guide How to Encode and Decode URLs — Step-by-Step Guide →