URL Encoder

Percent-encode / decode URLs

About This Calculator

URL encoding (percent-encoding) ensures that special characters in URLs are transmitted correctly over the internet. Characters that are not allowed raw in URLs are replaced with a percent sign followed by their two-digit hexadecimal ASCII code.

Formula

Replace unsafe characters with %XX where XX is the hex ASCII code
Space = %20 (or + in query strings); reserved chars: ! # $ & ' ( ) * + , / : ; = ? @ [ ]
Unreserved chars (A-Z, a-z, 0-9, - _ . ~) are never encoded

Example Calculation

Encode 'Hello World! @2024'

  1. Space → %20
  2. ! → %21, @ → %40
  3. Digits and letters stay unchanged
Hello%20World%21%20%402024

Common URL-Encoded Characters

CharacterEncodedCharacterEncoded
Space%20#%23
!%21$%24
@%40&%26
=%3D?%3F
/%2F:%3A
+%2B%%25

Frequently Asked Questions

What is the difference between %20 and + for spaces?
In the path part of a URL, spaces must be encoded as %20. In query strings (after ?), spaces may be encoded as + (application/x-www-form-urlencoded). When in doubt, %20 is always safe.
Why do some characters need to be encoded in URLs?
Characters like ?, &, =, and # have special meaning in URLs (query separator, key-value separator, fragment). To include these literally in a value, they must be percent-encoded so parsers don't misinterpret them.
What is encodeURIComponent vs encodeURI in JavaScript?
encodeURI encodes a complete URL and leaves structural characters (/, :, ?, #, &) unencoded. encodeURIComponent encodes a single URL component (like a query parameter value) and encodes everything except A-Z, a-z, 0-9, - _ . ! ~ * ' ( ).