URL / Base64 encoder & decoder
Convert between URL-encoding, URL-decoding, Base64-encoding and Base64-decoding. Full UTF-8 and emoji support.
URL encoding
Base64
URL-safe Base64
URL encoding and Base64 — what each is for
They solve different problems and are frequently confused. URL encoding (percent-encoding) makes text safe to place inside a URL. Reserved characters — :, /, ?, &, =, # — carry structural meaning, so any of them appearing in data must be replaced by %XX sequences. A space becomes %20 in a path or + inside a form-encoded query.
The distinction between encodeURI and encodeURIComponent matters: the former keeps the URL structure intact and is for encoding a whole URL, the latter escapes everything reserved and is what you want for a single query parameter value. Using the wrong one is the usual cause of links that break only for certain inputs.
Base64 is unrelated to URLs: it represents arbitrary bytes using 64 printable characters, which lets binary data travel through text-only channels — JSON payloads, email, data URIs, basic authentication headers. It expands data by about 33%, and it is an encoding, not encryption; anyone can reverse it.
Standard Base64 uses + and /, both of which have special meaning in URLs. URL-safe Base64 substitutes - and _ and drops the = padding — that is the variant to use for tokens in query strings, JWTs and signed URLs.
Finally, encoding is not the same as hashing: encoding is reversible and preserves length roughly, hashing is one-way and fixed length. If a value needs to be secret, neither is the answer.
Frequently asked questions
When should I use URL encoding instead of Base64?
URL encoding (percent-encoding) is for making text safe inside a URL — in query parameter values especially. Base64 is for representing arbitrary bytes as text, for example embedding binary data in JSON or a data URI.
What is URL-safe Base64?
Standard Base64 uses + and /, both of which have special meaning in URLs. URL-safe Base64 replaces them with - and _ and drops the trailing = padding, so the result can be placed in a URL unchanged.
Is Base64 encryption?
No. Base64 is an encoding — it is reversible by anyone with no key. Never use it to protect data; use encryption for that.