URL Encoder & Decoder

Handle special characters in URLs, support Chinese URL encoding.

What is URL Encoding?

URL encoding (also known as Percent-encoding) is a method to encode information in a Uniform Resource Identifier (URI). It replaces unsafe ASCII characters with a % followed by two hexadecimal digits.

Standard URLs can only contain a specific set of ASCII characters. If a URL contains spaces, Chinese characters, or special symbols (like &, =, +), the browser might interpret them incorrectly. URL encoding converts these characters into a safe format (e.g., a space becomes %20).

Why use URL Encoding?

  • Handling Non-ASCII Characters: When passing Chinese text or other non-English characters in URL parameters, encoding is mandatory to prevent garbled text.
  • API Development: When constructing API requests, special characters in parameters must be encoded to be correctly received by the server.
  • Preventing Truncation: Certain special characters (like #) are interpreted as anchors by browsers, which can cause subsequent parameters to be lost. Encoding prevents this issue.

Frequently Asked Questions (FAQ)

What does a space become in URL encoding?

A space is typically encoded as %20. In some older standards or form submissions, it might also be encoded as a + sign.

Do all characters need to be encoded?

No. Only non-ASCII characters (like Chinese) and URL reserved characters (like ?, /, :, @, &, = when used as data rather than separators) need encoding. Alphanumeric characters usually do not.