URL Encoder — Free Online URL Encoding Tool | GadgetSurge

Free online URL encoder. Percent-encode special characters in URLs and query strings instantly. Essential for API development and web scraping.

About URL Encoder

URLs can only contain a limited set of characters — letters, numbers, and a few special characters. Any other character, including spaces, ampersands, equals signs, and non-ASCII characters, must be encoded as a percent sign followed by two hexadecimal digits. This process is called URL encoding or percent encoding.

This free URL encoder converts any text into a URL-safe format. A space becomes %20, an ampersand becomes %26, and special characters like ü or 中 become their UTF-8 byte sequences encoded in percent format.

URL encoding is required when passing data as query string parameters, constructing API request URLs programmatically, handling form submissions, and working with international characters in web addresses.

There are two types of URL encoding: encoding an entire URL (which only encodes characters that are invalid in URLs) and encoding a URL component like a query parameter value (which encodes more characters, including /, ?, and &). This tool encodes components, which is the safer default for building query strings.

How to Use URL Encoder

  1. Paste the URL or text string you want to encode into the input field.
  2. Click "Encode" to percent-encode all special characters.
  3. Copy the encoded output for use in your URL, query string, or API request.
  4. Use the companion URL Decoder to reverse the process.

Common Use Cases

Frequently Asked Questions

What is URL encoding?

URL encoding (also called percent encoding) converts characters that are not allowed in URLs into a safe format. Each disallowed character is replaced by a percent sign followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20 and an ampersand becomes %26.

What is the difference between encodeURI and encodeURIComponent?

encodeURI encodes a complete URL — it does not encode characters that have special meaning in URLs like /, ?, #, and &. encodeURIComponent encodes a URL component (like a single query parameter value) — it encodes those special characters too. Use encodeURIComponent when encoding values that will appear as query parameters.

Why does a space become %20 and not +?

Both %20 and + represent a space in URLs, but in different contexts. %20 is the standard percent-encoding and works everywhere. + is only valid for spaces in application/x-www-form-urlencoded format (HTML form submissions). For query parameters in general URL construction, %20 is more universal and correct.

Do I need to encode the entire URL or just parts of it?

Only encode the component parts of a URL — specifically query parameter values and path segments that contain special characters. Do not encode the entire URL including the https://, domain, and slashes, as that will break the URL structure.

What characters do not need encoding?

The "unreserved characters" are safe in URLs without encoding: A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~). Everything else, including spaces, !, @, #, $, %, ^, &, *, (, ), +, =, should be encoded in component values.