URL Encoder — Free, Instant & Online

Encode URLs and special characters to percent-encoded format instantly. Choose between full URI encoding or component encoding — all processed in your browser with zero uploads.

Need to decode? URL Decoder →
Encoding mode:
Encodes all special characters including ? & = # /
0
Input chars
0
Output chars
0
Chars encoded
--
Size expansion

What Is URL Encoding and Why Does It Matter?

URL encoding, formally defined as percent-encoding in RFC 3986, is the process of converting characters that are not allowed in a URL into a safe, transmittable format. Every character that is not an unreserved character — meaning it is not a letter, digit, hyphen, underscore, period, or tilde — must be encoded before it can appear in a URL.

Encoding works by replacing the unsafe character with a percent sign (%) followed by two hexadecimal digits that represent the character’s ASCII or UTF-8 byte value. A space becomes %20, an ampersand becomes %26, and an equals sign becomes %3D. Without encoding, URLs break, servers misinterpret parameters, and data is silently corrupted in transit.

encodeURIComponent vs encodeURI: Which One Should You Use?

This is the most common source of confusion in URL encoding. The two JavaScript functions behave very differently and choosing the wrong one causes subtle bugs that are hard to track down.

encodeURIComponent — For Query Parameter Values

encodeURIComponent encodes everything except letters (A–Z, a–z), digits (0–9), and the six characters - _ . ! ~ * ' ( ). This means it encodes all URL structural characters including /, ?, &, =, and #. Use this function when you are encoding a single value that will be embedded inside a URL — for example, a search query, a user name, or a file path that needs to go into a query parameter.

Example: encoding hello world & more with encodeURIComponent gives hello%20world%20%26%20more — safe to use as a parameter value.

encodeURI — For Complete URLs

encodeURI assumes the input is already a valid URL structure and deliberately skips encoding characters that have meaning inside a URL: ; , / ? : @ & = + $ #. Use this when you have a complete URL that already has its path and query string formed and you just need to make the non-ASCII characters safe without breaking the URL’s structure.

Example: encoding https://example.com/search?q=hello world with encodeURI gives https://example.com/search?q=hello%20world — the structure is preserved and only the space is encoded.

Common URL Encoding Reference Table

CharacterEncodedNotes
Space%20Most common encoding need
!%21Encoded by encodeURIComponent
#%23Fragment identifier in URLs
$%24
&%26Separates query parameters
'%27
+%2BUsed as space in form encoding
,%2C
/%2FPath separator
:%3AProtocol separator
;%3B
=%3DKey-value separator
?%3FQuery string start
@%40Used in userinfo
[%5B
]%5D

Real-World URL Encoding Use Cases

Building API Query Parameters

When calling REST APIs with dynamic values, always encode each parameter value with encodeURIComponent before appending it to the URL. If a user searches for café & bakery, you must encode it as caf%C3%A9%20%26%20bakery before inserting it into your request URL. Failing to do so sends a malformed request that the server may reject or misparse.

Sharing URLs With Special Characters

File names on web servers often contain spaces, parentheses, or accented characters. A file named Q3 Report (Final).pdf must be encoded as Q3%20Report%20%28Final%29.pdf to be served correctly by most web servers. This is especially important in S3 bucket URLs, CDN paths, and SharePoint links.

OAuth and Authentication Tokens

OAuth 1.0a signatures and many authentication schemes require all URL components to be percent-encoded, including the parameter names. Encoding must be precise — a missing or incorrect character encoding causes signature mismatches and authentication failures.

Sending Data Through Email and Messaging

Links shared through email clients, SMS, and many chat platforms can be corrupted by line-break insertion or character stripping. A properly encoded URL survives these transformations because it contains only ASCII-safe characters.

Avoiding Double-Encoding

A frequent mistake is encoding a string that has already been encoded. This turns %20 into %2520 (encoding the percent sign itself), producing a URL that decodes to the wrong value. Always check whether your input is already encoded before running it through the encoder. If it contains % followed by two hex digits, it is likely already encoded.

URL Encoding and SEO

Search engines handle percent-encoded URLs correctly, but there are SEO best practices worth following. Use lowercase hex digits in encoded sequences (%2f instead of %2F) for consistency. Prefer hyphens to encoded spaces in URL paths — /blog/hello-world is better than /blog/hello%20world. For query parameters containing non-ASCII characters such as Chinese, Arabic, or Japanese text, percent-encoding is required and Google handles it correctly.

FAQ

Frequently Asked Questions

URL encoding, also called percent-encoding, is a way to represent characters that are not allowed or have special meaning in a URL. It replaces unsafe characters with a percent sign (%) followed by two hexadecimal digits representing the ASCII code of the character. For example, a space becomes %20, an ampersand becomes %26, and a forward slash becomes %2F. URL encoding ensures that URLs are valid and can be correctly transmitted across the internet.

encodeURI encodes a full URL and does not encode characters that are part of the URL structure: letters, digits, and the symbols - _ . ! ~ * ' ( ) ; / ? : @ & = + $ , # are all left as-is. Use it when you want to encode a complete URL while keeping its structure intact. encodeURIComponent encodes a URL component such as a query parameter value and encodes all characters except letters, digits, - _ . ! ~ * ' ( ). This means it also encodes /, ?, &, =, and # which makes it suitable for encoding individual values that will appear inside a URL.

Use URL encoding whenever you need to include special characters in a URL. Common scenarios include building query parameters that contain spaces or symbols (for example, a search query), passing user-generated content as URL parameters, encoding file names with spaces or special characters in web paths, sending data through HTTP GET requests, and constructing API endpoints programmatically. Without encoding, special characters can break the URL or be misinterpreted by servers and browsers.

Characters that must be encoded include: space ( ), double quote ("), hash (#), percent (%), less-than (<), greater-than (>), opening bracket ([), closing bracket (]), backslash (\), caret (^), grave accent (`), opening brace ({), pipe (|), and closing brace (}). Characters with special meaning in URLs that may need encoding in certain contexts include: colon (:), forward slash (/), question mark (?), hash (#), at sign (@), exclamation mark (!), dollar sign ($), ampersand (&), single quote ('), asterisk (*), plus sign (+), comma (,), semicolon (;), and equals sign (=).

A space is encoded as %20 in standard percent-encoding (RFC 3986), which is what encodeURIComponent and encodeURI use. However, in HTML form data submitted via the GET method (application/x-www-form-urlencoded), spaces are encoded as plus signs (+). When you see + signs in a URL from a web form search, those are spaces in form-encoded format. This tool uses the standard %20 encoding which is universally correct for all URL contexts.

No, they are completely different. URL encoding (percent-encoding) replaces individual unsafe characters with their % hex equivalents and keeps safe characters unchanged. The output is still human-readable. Base64 encoding converts binary data into a limited ASCII alphabet of 64 characters and the output is completely transformed and unreadable. Use URL encoding for URLs and query parameters. Use Base64 for embedding binary data in text formats like HTML, CSS, or JSON.

Yes. Unicode characters (letters from Chinese, Arabic, Japanese, accented European characters, emoji, etc.) are first converted to their UTF-8 byte sequences and then each byte is percent-encoded. For example, the Euro sign € (U+20AC) becomes %E2%82%AC in UTF-8 percent-encoding. This tool handles all Unicode text correctly using the browser's built-in encodeURIComponent function which follows the UTF-8 standard.

To encode a full URL that already has its structure in place (like https://example.com/search?q=hello world&lang=en), use the encodeURI mode. It will encode the space as %20 but leave the ://, ?, &, and = intact. If you want to encode just the value of a query parameter before appending it to a URL, use encodeURIComponent mode on just the value (e.g. "hello world&lang=en"). This gives you %22hello%20world%26lang%3Den" which is safe to use as a parameter value.

Yes, completely private. All URL encoding happens entirely in your browser using JavaScript. Your input is never sent to a server, never stored, never logged, and never transmitted over the internet. You can even go offline after the page loads and the tool continues to work perfectly.

Yes, completely free with no account, no sign-up, no usage limits, and no ads. All processing happens client-side in your browser, so there are no server costs. This tool will always be free.