URL encoding (also called percent-encoding) is a fundamental concept every web developer needs to understand. If you've ever seen %20 in a URL, you've encountered URL encoding in action. This guide explains what URL encoding is, why it's necessary, and how to use a free URL encoder/decoder to handle special characters in your URLs.

What is URL Encoding?

URL encoding converts characters that are not allowed in a URL into a format that can be safely transmitted over the internet. It replaces unsafe ASCII characters with a % sign followed by two hexadecimal digits representing the character's ASCII code. For example, a space becomes %20, and a forward slash becomes %2F.

The official specification, defined in RFC 3986, ensures that URLs are universally understood by browsers, servers, and APIs regardless of the characters they contain.

Why Do We Need URL Encoding?

URLs have a restricted character set. Certain characters have special meanings in the URL syntax:

If your data contains these characters, they must be encoded so they aren't misinterpreted as URL syntax. Non-ASCII characters (like Unicode, Chinese, Japanese, or accented characters) must also be encoded because URLs only support ASCII.

Characters That Must Be Encoded

There are three categories of characters in URLs:

Reserved Characters

These have special meanings and must be encoded if used as data: :, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ;, =

Unsafe Characters

These have no special meaning but may cause issues: space (%20), double quote (%22), < (%3C), > (%3E), \ (%5C), ^ (%5E), backtick (%60), { (%7B), } (%7D), | (%7C)

All Non-ASCII Characters

Any character above U+007F must be encoded. For example, the Chinese character δΈ­ζ–‡ becomes %E4%B8%AD%E6%96%87 in UTF-8 percent-encoding.

URL Encoding vs Component Encoding

There's an important distinction between encoding a full URL and encoding just one component. JavaScript provides two functions:

Using encodeURIComponent() for query parameters is essential β€” forgetting to encode values is a common source of broken URLs.

Common URL Encoding Examples

Character Encoded Usage
Space %20 Form data, search queries
& %26 Ampersand in parameter values
= %3D Equals sign in parameter values
# %23 Hash in parameter values
+ %2B Plus sign (not space encoding)

How to Encode/Decode URLs Online

Use the URL encoder/decoder at Wang Toolbox for instant encoding and decoding. Simply paste your text, click "Encode" or "Decode", and the result appears immediately. The tool runs entirely in your browser β€” your data never touches a server. It also supports "component mode" for encoding query parameter values where slashes and colons should also be encoded.

URL Encoding in Different Languages

Most programming languages provide URL encoding functions:

Common Pitfalls

Try our free URL encoder/decoder tool today. Also check out the HTML encoder and Base64 encoder/decoder for more encoding needs.

Related Tools

URL Encoder/Decoder HTML Encoder Base64 Encode/Decode URL Analyzer