URL Encoder / Decoder – Percent Encoding Tool
Encode special characters for safe URL transmission, or decode percent‑encoded strings back to readable text. 100% client‑side, private, free, instant.
What is URL Encoding (Percent‑Encoding)?
URL encoding, also known as percent‑encoding, replaces unsafe ASCII characters with a `%` followed by two hexadecimal digits. It ensures that URLs can be transmitted over the internet without corruption. For example, a space becomes `%20`, an ampersand `&` becomes `%26`, and a slash `/` remains safe but sometimes is encoded as `%2F` when used in query parameters.
The standard is defined in RFC 3986. Our tool uses the browser’s built‑in `encodeURIComponent()` and `decodeURIComponent()` functions, which follow this standard and also support UTF‑8 for non‑English characters and emojis.
When to Use URL Encoding
- Query parameters: When you have special characters in parameter values (spaces, &, #, ?, etc.) you must encode them to avoid breaking the URL structure.
- Form data submitted via GET: HTML forms automatically percent‑encode data, but if you build URLs manually, you need to encode.
- API calls: Many APIs expect encoded parameters, especially when passing user‑generated text.
- Opaque data in URLs: If you need to embed a JSON string or XML fragment in a URL, you must encode it first.
- Redirect URLs: When constructing redirect URLs that contain another URL as a parameter, the inner URL must be encoded.
encodeURIComponent vs encodeURI – What’s the Difference?
- encodeURIComponent(): Encodes all special characters, including `?`, `&`, `=`, `/`, `#`. Use this for encoding individual query parameter values. Example: `encodeURIComponent("hello world?test")` → `"hello%20world%3Ftest"`.
- encodeURI(): Leaves `?`, `&`, `=`, `/`, `#` untouched, preserving the URL structure. Use this for encoding a full URL (but not its query parameters). Example: `encodeURI("https://example.com/path?name=john doe")` → `"https://example.com/path?name=john%20doe"` (only the space is encoded).
Our tool uses `encodeURIComponent()` because it is the most common requirement for developers dealing with API parameters. If you need the other method, you can adapt the logic – but for most use cases, this is correct.
UTF‑8 and Special Characters
URL encoding works on bytes, not characters. The browser first converts the string to UTF‑8 bytes, then percent‑encodes each byte. This means emojis, Chinese characters, and accented letters are correctly handled. For example, `你好` becomes `%E4%BD%A0%E5%A5%BD`. This tool fully supports Unicode.
Common URL Encoding Mistakes and How to Avoid Them
- Double encoding: If you encode a string that is already encoded, you’ll get percent signs encoded as `%25`. For example, `%20` becomes `%2520`. Our Decode button will first try to decode once; if you see unexpected `%25`, decode again.
- Decoding malformed percent sequences: If you try to decode a string that contains `%` not followed by two hex digits, the browser will throw an error. Our tool catches that and shows a helpful message.
- Forgetting to encode the entire query string: Only encode individual parameter values, not the entire `?key=value&key2=value2` – the equals signs and ampersands should remain unencoded.
Why Use a Client‑Side URL Encoder?
Many online tools send your data to a server for processing – a security risk if you’re dealing with API keys or personal information. Our tool runs entirely in your browser. No data is transmitted, logged, or stored. You can even disconnect from the internet after the page loads and it still works perfectly. This makes it ideal for developers handling sensitive tokens or debugging authentication flows.
How to Use the Tool
- Paste your text or URL parameter value into the top text area.
- Click “Encode (URL encode)” to percent‑encode the text.
- Click “Decode (URL decode)” to reverse the process.
- Use “Load Sample” to see a working example.
- Click “Copy Output” to copy the result to your clipboard.
- Click “Share Tool” to send the link to a colleague.
All operations are instant and free.