URL Encode
Percent-encode the contents of a text file for safe URLs.
Add a file
JSON, XML, text or any file you want to encode, decode or hash.
Choose an output
Percent-encode the contents of a text file for safe URLs.
About URL Encode
This tool percent-encodes the contents of a text file using JavaScript's encodeURIComponent, so the text can be placed safely inside a URL query parameter or path segment. Reserved characters like &, =, ?, / and spaces become %XX sequences, and non-ASCII characters are encoded as UTF-8 bytes.
When it helps
- Putting a search phrase, email address or redirect URL into a query parameter without breaking the link.
- Building a mailto: link with a subject and body that contain spaces and line breaks.
- Encoding a JSON snippet or filter expression to pass as a single URL parameter.
Tips
- Spaces become %20, not +. Both are understood by most servers in query strings, but only %20 is correct in a path.
- Because / ? & and = are all encoded, do not run a complete URL through this tool. Encode only the individual value you are inserting.
- Letters, digits and the characters - _ . ! ~ * ' ( ) are left as is, which matches the behavior of encodeURIComponent in every browser.
Good to know
Quick answers about url encode in your browser.
encodeURI leaves URL structure characters such as / ? & = and # alone, so it is meant for whole URLs. encodeURIComponent, which this tool uses, encodes them too, which is what you want for a single parameter value.
Percent-encoding works on bytes. A character such as é is two bytes in UTF-8, so it becomes %C3%A9.
Yes. There is no sign-up, no watermark and no limit on how many files you process.
No. Files are read and processed locally in your browser, so they never leave your device.
Related tools
Part of the Developer Tools collection.