URL Encoder / Decoder

Convert strings to a URL-safe format (percent-encoding) and back.


What is URL Encoding?

URL encoding, also known as percent-encoding, is the process of converting characters into a format that can be safely transmitted over the internet. URLs can only contain a specific set of characters (ASCII). Any character outside this set must be encoded to ensure it is interpreted correctly by web servers and browsers.

Why is URL Encoding Necessary?

Reserved Characters
Certain characters have special meanings in a URL's structure. For example, the question mark ? separates the URL path from the query parameters, and the ampersand & separates different parameters. If you need to use these characters literally within a parameter's value, they must be encoded (e.g., ? becomes %3F).
Unsafe Characters
Some characters, like spaces, are not allowed in URLs at all. A space must be encoded as %20 or sometimes as a + symbol to be transmitted correctly. Other unsafe characters include quotation marks ("), angle brackets (< >), and the pound sign (#).
Non-ASCII Characters
URLs are traditionally limited to the ASCII character set. Any character outside this set, such as accents (é), umlauts (ü), or characters from other languages (你好), must be encoded to be represented in a URL.

How Does it Work?

The encoding process replaces an unsafe character with a percent sign (%) followed by the two-digit hexadecimal representation of the character's byte value.
Example: The space character has a hexadecimal value of 20, so it is encoded as %20. The ampersand (&) has a hex value of 26, so it is encoded as %26.