URL Encoder & Decoder

Encode and decode URLs instantly

Use this free URL encoder to convert text to URL-safe format using percent encoding, or decode URL-encoded strings back to readable text. Essential for working with query parameters, form data, and APIs. 100% client-side — your data never leaves your browser.

Advertisement
Encoding type:
Advertisement

Common URL Encodings

Character Encoded Description
space%20Space character
!%21Exclamation mark
#%23Hash/pound
$%24Dollar sign
%%25Percent sign
&%26Ampersand
+%2BPlus sign
/%2FForward slash
=%3DEquals sign
?%3FQuestion mark
@%40At sign

Understanding URL Encoding

What is URL Encoding?

URL encoding (also called percent encoding) converts characters into a format that can be safely transmitted in URLs. Since URLs can only contain a limited set of ASCII characters, special characters must be encoded.

Each unsafe character is replaced with a % followed by two hexadecimal digits representing the character's ASCII value. For example, a space (ASCII 32, hex 20) becomes %20.

encodeURIComponent vs encodeURI

JavaScript provides two encoding functions with different use cases:

  • encodeURIComponent: Encodes almost all special characters. Use this for query parameter values, form data, and any text that will be part of a URL.
  • encodeURI: Preserves URL structure characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =). Use this when encoding a complete URL that should remain valid.

When to Use URL Encoding

  • Query parameters: When passing user input in URL query strings
  • API requests: When sending data to REST APIs
  • Form submissions: When encoding form data for GET requests
  • Special characters: When URLs contain spaces, &, =, or non-ASCII characters

URL Encoder FAQ

What is URL encoding?

URL encoding converts characters into a format safe for URLs. Special characters like spaces, &, =, and non-ASCII characters are replaced with %XX where XX is the hexadecimal ASCII value. For example, a space becomes %20.

What is the difference between encodeURI and encodeURIComponent?

encodeURIComponent encodes all special characters and is used for query parameter values. encodeURI preserves URL structure characters like : / ? # and is used for encoding complete URLs while keeping them valid.

Why does space become %20?

The number 20 is the hexadecimal ASCII code for the space character (decimal 32). URL encoding uses hexadecimal values prefixed with %, so space becomes %20.

What characters need to be URL encoded?

Characters that need encoding include: spaces, ! # $ % & ' ( ) * + , / : ; = ? @ [ ], and any non-ASCII characters (like é, ñ, 中文). Safe characters that don't need encoding are: A-Z a-z 0-9 - _ . ~

Is + the same as %20 for spaces?

In application/x-www-form-urlencoded format (HTML forms), spaces are encoded as +. In standard URL encoding (RFC 3986), spaces are %20. This tool uses standard percent encoding with %20 for spaces.

Advertisement