URL Encoder/Decoder

Encode or decode URL strings easily. Useful for working with query parameters and special characters.

Input
Output
About URL Encoding

URL encoding converts special characters into a format that can be safely transmitted in URLs.

Common Conversions:

  • space → %20
  • & → %26
  • = → %3D
  • ? → %3F
  • / → %2F
  • # → %23

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 like spaces, ampersands, question marks, and non-ASCII characters must be encoded as %XX where XX is the hexadecimal representation of the character's byte value.

How URL Encoding Works

Characters are encoded differently based on their type:

  • Unreserved characters (A-Z, a-z, 0-9, -._~) are not encoded.
  • Spaces are encoded as %20 (or + in form data).
  • Reserved characters (!#$&'()*+,/:;=?@[]) are encoded when used as data rather than delimiters.
  • Non-ASCII characters are first converted to UTF-8 bytes, then each byte is percent-encoded.

Common Encoded Characters

CharacterEncodedDescription
(space)%20Space character
!%21Exclamation mark
#%23Hash (fragment identifier)
&%26Ampersand (query parameter separator)
=%3DEquals (key-value separator)
?%3FQuestion mark (query start)
/%2FForward slash (path separator)
@%40At sign

Common Use Cases

  • Query Parameters: Encode user input before including it in URL query strings to prevent broken or malicious URLs.
  • API Requests: Properly encode parameter values when constructing API endpoints programmatically.
  • Form Submissions: HTML forms automatically URL-encode data in GET requests. Understanding encoding helps debug form issues.
  • Redirect URLs: Encode callback URLs and redirect URIs to preserve special characters.
  • File Paths: Encode filenames with spaces or special characters in download URLs.

Frequently Asked Questions

What is the difference between %20 and + for spaces?

%20 is used in URL paths and general percent-encoding. + is used only in application/x-www-form-urlencoded form data (HTML form submissions). In most API contexts, %20 is the correct encoding for spaces.

Should I encode the entire URL or just the values?

Only encode parameter values and path segments that contain special characters. Do not encode the URL structure itself (protocol, host, path separators, query delimiters).