🧮 CalcMaster

URL Encode / Decode

Encode special characters in URLs using percent-encoding or decode URL-encoded strings.

URL Encode / Decode

Encoded / Decoded URL

Enter values and click Calculate

Frequently Asked Questions

What is URL encoding and why is it needed?

URL encoding (percent-encoding) replaces special characters in URLs with a percent sign followed by two hexadecimal digits. For example, a space becomes %20 and an ampersand becomes %26. URLs can only contain certain safe characters (letters, digits, and a few symbols). Characters outside this set — including spaces, non-ASCII letters, and punctuation — must be encoded so browsers and servers can correctly interpret query strings, paths, and form data without ambiguity or parsing errors.

What is the difference between encodeURI and encodeURIComponent in JavaScript?

encodeURI() encodes a full URL, preserving characters like /, ?, =, and & that have special meaning in URL structure. encodeURIComponent() is more aggressive and encodes everything except alphanumeric characters and - _ . ! ~ * ' ( ), making it ideal for encoding individual query parameter values. For example, encoding "a=1&b=2" as a query value requires encodeURIComponent to escape the = and & signs; otherwise the server would misparse it as multiple separate parameters.

How do I decode a percent-encoded URL?

To decode a percent-encoded URL, replace each %XX sequence with the character it represents, where XX is a hexadecimal ASCII code. For example, %20 → space, %3D → =, %2F → /, %40 → @. In JavaScript, use decodeURIComponent() or decodeURI() to decode automatically. Most modern browsers display decoded URLs in the address bar for readability while sending the encoded version to servers. URL decoding is essential when parsing query strings, debugging API requests, or reading redirect URLs in web applications.