URL Encode
Percent-encode text for safe use in URLs.
Related Tools
Decode percent-encoded URL text back to plain text.
Encode or decode Base64 for text and files, Unicode-safe.
Decode JWT header, payload, and signature with expiry and algorithm warnings.
Beautify and pretty-print JSON with configurable indentation.
Escape HTML entities to safely display raw markup as text.
Unescape HTML entities back to raw characters.
Documentation
What is URL Encode?
URL Encode (percent-encoding) converts characters that aren't safe or unambiguous inside a URL — spaces, &, ?, non-ASCII text — into a %XX hex sequence, so the value can be dropped into a query string or path segment without colliding with the URL's own syntax.
How it works
This tool calls the browser's native encodeURIComponent() on your input. It percent-encodes everything except unreserved characters — letters, digits, and - _ . ! ~ * ' ( ) — which means it also encodes characters like /, ?, &, and = that are reserved for separating URL components. That's the key difference from encodeURI(), which leaves those reserved characters alone because it's meant for encoding a whole URL rather than one value going inside it — this tool intentionally uses the stricter, component-level function since a single query parameter is the most common case.
Features
- Matches JavaScript's encodeURIComponent exactly, byte for byte
- Handles Unicode text (encoded as UTF-8 percent sequences)
- Runs on keystroke or Cmd/Ctrl+Enter, entirely client-side
- Copy the encoded value directly into a query string or path segment
Example
Input: https://devformats.com/search?q=json formatter & validator
Output:
https%3A%2F%2Fdevformats.com%2Fsearch%3Fq%3Djson%20formatter%20%26%20validator
Edge cases
Encoding an already-encoded value ("double encoding") turns a literal %20 into %2520, which then decodes back to %20 instead of a space — a frequent source of broken redirect URLs. Because the whole input is encoded as one component, running this over a full URL (rather than just a query value) also escapes the :// and path slashes, which is usually not what you want — encode individual parameter values, not the entire URL.
Best practices
Encode each query parameter value or path segment individually, right before assembling the final URL — never encode the URL's structural characters (:, /, ?, &) that separate its parts. Track whether a value has already been encoded (e.g. when it's passed between services) to avoid the double-encoding trap above.
Spec
RFC 3986 — Uniform Resource Identifier (URI): Generic Syntax
Frequently Asked Questions
What characters get encoded?▾
Everything except letters, digits, and a small set of unreserved characters (- _ . ! ~ * ' ( )) is percent-encoded, matching JavaScript's encodeURIComponent.
When do I need this?▾
Whenever a value (like a search query or a redirect URL) is going into a query string or path segment and might contain spaces, &, ?, or other characters with special meaning in a URL.
Is my data uploaded anywhere?▾
No — encoding runs entirely in your browser.