What is URL Encoding?
URL encoding — also called percent-encoding — converts characters that are not allowed in URLs into a safe format. Each unsafe character is replaced by a percent sign (%) followed by two hexadecimal digits representing the character’s byte value in UTF-8.
For example, a space becomes %20, an ampersand & becomes %26, and the euro sign € becomes %E2%82%AC. This tool uses JavaScript’s encodeURIComponent and decodeURIComponent functions, which handle the full Unicode range correctly.
When Do You Need URL Encoding?
URLs can only contain a limited set of characters defined by RFC 3986. Any character outside that set must be percent-encoded before the URL is used. Common situations include:
- Query string parameters:
?search=hello%20world - Path segments with special characters:
/search/cafémust become/search/caf%C3%A9 - Redirect URLs embedded as parameters:
?next=https%3A%2F%2Fexample.com%2Fpage - Form data submitted via GET requests
- API calls where parameter values contain reserved characters
Failing to encode special characters causes broken links, incorrect query parsing, and security vulnerabilities like open-redirect attacks.
encodeURI vs. encodeURIComponent
JavaScript provides several encoding functions with different behaviour:
| Function | Leaves untouched | Best for |
|---|---|---|
encodeURI() | :/?#[]@!$&'()*+,;= | Encoding a complete URL |
encodeURIComponent() | Letters, digits, -_.!~*'() | Encoding individual parameter values |
escape() (deprecated) | Letters, digits, @*_+-./ | Nothing — avoid it |
This tool uses encodeURIComponent because encoding individual values is by far the most common use case. If you need to encode a full URL without touching its structure, use encodeURI instead (not available in this tool).
Common URL Encoding Examples
| Original text | Encoded result |
|---|---|
hello world | hello%20world |
user@example.com | user%40example.com |
price=€10 | price%3D%E2%82%AC10 |
a&b=c+d | a%26b%3Dc%2Bd |
/path/to/page | %2Fpath%2Fto%2Fpage |
<script>alert(1)</script> | %3Cscript%3Ealert(1)%3C%2Fscript%3E |
How to Use the URL Encoder
- Paste your text or URL-encoded string into the input box.
- Click Encode URL to convert plain text to percent-encoding.
- Click Decode URL to convert a percent-encoded string back to plain text.
- Click Copy to copy the result to your clipboard.
The encoder also runs live as you type in encode mode, so you can see the result immediately.
What is Base64?
Base64 is an encoding scheme that represents binary or text data using 64 printable ASCII characters: uppercase letters A–Z, lowercase letters a–z, digits 0–9, +, and /. A padding character = is added when necessary.
Base64 is widely used to:
- Embed images directly in HTML or CSS as data URIs:
src="data:image/png;base64,..." - Transmit binary data in JSON payloads that only support text
- Encode data in HTTP Authorization headers (
Basic dXNlcjpwYXNz) - Store binary content in XML, YAML, or plain-text configuration files
Important: Base64 is not encryption. It is a reversible encoding that anyone can decode instantly. Never use Base64 to hide sensitive data.
Base64 and Unicode
The browser’s native btoa() function only handles ASCII and Latin-1 characters. This tool handles the full Unicode range by converting text to UTF-8 bytes first before applying Base64 encoding, and reversing the process when decoding. Emoji, Chinese characters, Arabic script and other Unicode text are all supported.
Base64 vs. URL Encoding — Side by Side
| URL Encoding | Base64 | |
|---|---|---|
| Primary use | URL parameters and paths | Binary data in text formats |
| Output readability | Partially readable | Opaque ASCII |
| Output size | Varies (3× for non-ASCII) | Always ~33% larger |
| Reversible | Yes | Yes |
| Security | None | None |
| Handles Unicode | Yes (via UTF-8 bytes) | Yes (with UTF-8 pre-processing) |
Privacy and Security
All encoding and decoding happens entirely in your browser. This tool uses only built-in JavaScript functions:
encodeURIComponent/decodeURIComponentfor URL encodingbtoa/atobwith UTF-8 pre-processing for Base64
Your data is never sent to any server, stored, logged, or shared. You can even use this tool offline once the page has loaded.