EazyTools LogoEazyTools

URL Encode/Decode

Percent-encode or decode URLs and query strings instantly.

About URL Encode/Decode

What is URL Encoding?
URL Encoding, officially known as Percent-encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI). URLs can only be sent over the Internet using the US-ASCII character-set. Because URLs often contain characters outside the ASCII set, or characters that have special structural meanings in URLs (like ?, &, and =), they must be converted into a valid format. URL encoding replaces these unsafe characters with a % followed by two hexadecimal digits.

Component vs. Full URL Encoding
Our tool offers two distinct JavaScript algorithms:
- Encode Component (encodeURIComponent): This encodes everything, including URL structural characters like slashes (/) and question marks (?). It should be used exclusively when encoding a specific query parameter value (e.g., the value in ?key=value).
- Encode Full URL (encodeURI): This encodes strings while preserving reserved URL characters. It ensures that a full URL remains a valid link while fixing spaces and special characters within the path.

How to use this tool:
1. Paste your string into the "Input" box.
2. Choose the appropriate Encode or Decode button based on whether you are formatting a full link or just a data parameter.
3. The safely encoded or decoded string will appear in the output box, ready to be copied.

Frequently Asked Questions

What is the difference between encodeURI and encodeURIComponent?

encodeURI is designed for entire URLs; it ignores reserved characters that have special meaning in a URL (like :, /, ?, #, &, =). encodeURIComponent is designed for individual components (like a query string parameter) and encodes absolutely everything. Using the wrong one will either break your URL structure or result in invalid parameters.

Why do spaces become '%20'?

A space character is not allowed in a valid URL. According to the standard percent-encoding rules, the space character is mapped to its ASCII hex equivalent, which is 20. Therefore, it becomes %20. (Note: in some specific form data encodings like application/x-www-form-urlencoded, spaces are converted to '+' instead).

Is URL Encoding the same as HTML Encoding?

No. URL encoding is for web addresses and HTTP requests, converting characters to %XX formats. HTML encoding (or escaping) is used to display special characters safely on a web page, converting them to HTML entities like &amp; for '&' or &lt; for '<'.

Why am I getting a decoding error?

Decoding will fail if the input contains an invalid percent-encoded sequence. For example, a single '%' sign not followed by two valid hexadecimal digits will throw a Malformed URI error. Ensure your string is completely and correctly percent-encoded.