URL Encode & Decode
Percent-encode text for URLs, or decode it back — RFC 3986 and form encoding.
Convert text into a form that is safe to put inside a URL, or decode a percent-encoded string back into readable text. Both encoding styles are available, because choosing the wrong one is the single most common cause of broken links and mangled query parameters.
UTF-8 is handled throughout, so accented characters, emoji and non-Latin scripts encode and decode correctly.
How it works
URLs may only contain a restricted set of ASCII characters. Anything outside it
— spaces, most punctuation, and every non-English character — must be
percent-encoded: replaced by % followed by the byte's hexadecimal
value. A space becomes %20, and é becomes
%C3%A9, two bytes because it is two bytes in UTF-8.
There are two encodings in common use, and they differ in exactly one place:
- RFC 3986 (percent encoding) encodes a space as
%20. Use this for path segments, and generally anywhere that is not a form submission. - Form encoding (
application/x-www-form-urlencoded) encodes a space as+. This is what HTML forms produce and what query strings traditionally use.
The mismatch causes a specific, recognisable bug: a value encoded with
+ for spaces, then decoded by something following RFC 3986, arrives
with literal plus signs where the spaces should be. If you have ever seen
John+Smith appear in your database, this is why.
Two further traps worth knowing. First, encode each component
separately, never a whole assembled URL — encoding the complete string will also
escape the :// and the separators, breaking it entirely. Second,
double encoding: running an already-encoded string through again turns
%20 into %2520, because the % itself gets
encoded.
Frequently asked questions
Should a space be %20 or +?
Both are valid, in different places. Use %20 in a URL path and with RFC 3986 encoding. Use + in query strings produced by HTML forms. If you decode with the wrong one, spaces turn into literal plus signs or vice versa.
Why did my URL turn into %2520?
It was encoded twice. The first pass turned a space into %20; the second pass encoded the % itself as %25, producing %2520. Decode it twice to recover the original, then fix the code path that encodes more than once.
Can I encode a whole URL at once?
You should not. Encoding the entire string also escapes the :// and the / and ? separators, which breaks the URL. Encode each parameter value individually, then assemble them.
Which characters actually need encoding?
Anything outside A-Z, a-z, 0-9 and the four characters - _ . ~ is reserved or unsafe. In practice: spaces, &, =, ?, #, /, +, % and every non-ASCII character all need it when they appear inside a value.
Does this handle emoji and non-English characters?
Yes. Text is treated as UTF-8, so each character encodes to its correct byte sequence — one percent-escape per byte — and decodes back intact.
Is percent encoding a form of security?
No. It makes text safe to transport in a URL; it provides no confidentiality and is not a defence against injection. Escaping for HTML, SQL or shell contexts is a separate concern with different rules.
Related tools
Base64 Encode / Decode
Encode text to Base64 or decode it back, including URL-safe Base64.
Developer UtilitiesHTML Encode / Decode
Safely escape HTML entities or decode them back to raw characters.
Developer UtilitiesJSON Formatter
Format, validate and minify JSON with precise error locations.
Developer UtilitiesPunycode Converter
Convert Internationalized Domain Names (IDNs) between Unicode and Punycode.
DNS & DomainSlug Generator
Convert any text into a URL-friendly slug.
Developer UtilitiesJWT Decoder
Decode a JSON Web Token and verify its signature and expiry.
Developer UtilitiesNeed hosting that just works?
Free SSL, daily backups and 24×7 support on every Loudhost plan.