Encode text for URLs
Percent-encode strings safely for use in URLs. Choose query-value or full-URL mode. Live, local, no server roundtrip.
hello%20world%3F%20%26foo%3Dbar
How to URL-encode: a complete step-by-step guide
URL percent-encoding (RFC 3986) replaces any byte that would confuse a URL parser with a %XX hex triplet. Reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) keep their syntactic role unless you escape them; unreserved characters (A-Z a-z 0-9 - _ . ~) are always safe. This encoder picks between encodeURIComponent (escapes everything reserved) and encodeURI (preserves URL skeleton).
- 01
Paste any string destined for a URL
Drop the raw value you want to embed in a URL — a search query, a redirect target, a mailto subject, a filename, a UTF-8 phrase. Spaces,
&,=,?,#, and any non-ASCII character all need escaping to survive a URL parser.If you're starting from a Unicode domain name (e.g.
例ãˆ.jp), use the Punycode Converter first — host names use a separate encoding from path/query components.RFC 3986reserved charsunreservedUTF-8query valueinput · raw text1 linehello world? &foo=bar
21 B · 21 charsraw · needs escape - 02
Pick encodeURIComponent or encodeURI
Component mode (
encodeURIComponent) escapes every reserved character — use it for a single query value, path segment, or form input. Full URL mode (encodeURI) preserves the URL skeleton (: / ? # & =) so an entire URL likehttps://example.com/path?q=valuestays parseable.Rule of thumb: encoding a piece you'll splice into a template → component. Encoding a whole URL you already assembled → full.
encodeURIComponentencodeURIRFC 3986 § 2.2skeletonsplicemode · selectorcomponentencodeURIComponent vs encodeURI
mode setRFC 3986 - 03
Watch the percent-encoded output
Every byte outside the unreserved set becomes a
%XXtriplet of UTF-8 bytes — space is%20,?is%3F,&is%26,=is%3D. Non-ASCII characters expand to multiple triplets (one per UTF-8 byte):é→%C3%A9,🚀→%F0%9F%9A%80.Note that
application/x-www-form-urlencodedform bodies use+for space instead of%20— that's a separate convention handled by your HTTP client (URLSearchParams), not by this encoder.%XX tripletUTF-8%20form-urlencodedliveoutput · percent-encoded%xxhello%20world%3F%20%26foo%3Dbar
31 B · 1 lineRFC 3986 § 2.1 - 04
Copy, download, or reverse it
Click Copy to send the encoded value to your clipboard, or Download to save as
.txt. Drop the result straight into a query string, anhref, a redirect URL, or a webhook parameter.To go the other way, paste the encoded string into the URL Decoder. For embedding entire structured payloads as a single token, pair this with the Base64 Encoder in URL-safe mode.
clipboard.txtround-tripURL-safeno networkexport · actions3 actions✓ Copied to clipboard ✓ Saved: url-encoded.txt ✓ 100% client-side
ready to ship0 outbound
Encoding without surprises
Always UTF-8 first
Use TextEncoder / TextDecoder for bytes ↔ string conversion. btoa alone breaks on non-ASCII.
URL-safe vs standard Base64
Standard uses +, /, =; URL-safe swaps to -, _, no padding. Don’t mix them.
Hashes aren’t passwords
SHA-256 is fast; that’s good for fingerprints, bad for passwords. Use bcrypt / argon2 for credentials.
Watch padding rules
Some decoders are strict about = padding, others auto-pad. If round-trips fail at exactly 1 or 2 bytes, check padding.
Use Web Crypto for keys
Generate cryptographic keys via crypto.subtle, never Math.random. The latter is predictable.
JWT decode ≠ verify
Decoding a JWT just splits and base64-decodes. Verification needs the issuer’s public key / shared secret.
When to URL-encode
Query strings, redirects, deep links.
Query parameters
Pass values containing &, =, +, or spaces safely. Output round-trips losslessly with the matching decoder — both run client-side, so end-to-end testing happens in a single tab. Encoding flows through TextEncoder for predictable UTF-8 semantics.
RFC-compliantOAuth redirects
Embed return_to URLs inside another URL. Web Crypto's subtle.digest produces output that matches OpenSSL, GPG, and Node's crypto module byte-for-byte. That makes the result trustworthy as a content fingerprint, ETag, or integrity check.
OpenSSL-matchedMailto links
Encode subject and body for mailto: URLs. Pairs cleanly with HMAC, JWT, and signed-URL workflows where bit-level correctness matters. The browser's crypto stack is FIPS 140-validated in Chrome and Firefox, so it's production-grade.
losslessAPI requests
Build clean GET URLs from arbitrary inputs. Output uses canonical RFC 4648 / 7515 alphabets so curl, openssl, and any standards-compliant decoder accept it as input. URL-safe variants drop padding for tokens that travel in query strings.
byte-identicalWebhooks
Encode signed tokens passed in URL params. Heavy hashing runs through useMemo so large inputs don't block typing. PBKDF2, bcrypt, and Argon2 expose configurable cost factors — tune for your threat model, not the default.
spec-gradeDeep links
Mobile deep links often nest URLs as parameters. Same input plus same options always yields identical bytes. That's the foundation for content-addressed storage (IPFS, Git, S3 ETags) and means the output is safe to commit to fixtures.
production-readyFrequently asked questions
Something missing?
Tell us what you need. We ship the top requests every two weeks.