Base64
Encode or decode Base64, URL-safe variant included
Base64 rewrites arbitrary bytes using only 64 printable characters — A-Z, a-z, 0-9, plus and slash — so that data can travel through systems that were designed to carry text. The encoding, standardised in RFC 4648, reads three bytes at a time and emits four characters, which is why the result is always about 33% larger than what you started with.
You meet it wherever binary has to pass through a text-shaped channel: data URIs that embed an image directly in CSS, the credentials in an HTTP Basic auth header, MIME email attachments, certificates in PEM files, and the header and payload segments of a JSON Web Token. It is worth being blunt about what it is not: Base64 is an encoding, not encryption. Anyone can reverse it, and this page does exactly that in one click.
How to use it
- Pick a directionEncode turns plain text into Base64; decode takes Base64 back to text. If a decode fails, the input usually contains a stray space or a line break that should not be there.
- Paste your inputText is read as UTF-8 before encoding, so accented characters, emoji and non-Latin scripts all round-trip correctly rather than being mangled to question marks.
- Choose a variant if you need oneURL-safe swaps plus for hyphen and slash for underscore and drops the padding, per RFC 4648 section 5. Line wrapping breaks the output into MIME-style 76-character lines.
- Copy the resultThe output pane updates as you type. Nothing is sent anywhere — the encoding runs in this tab using the browser’s own TextEncoder and btoa.
Frequently asked questions
Is Base64 a form of encryption?
No. Base64 provides no secrecy whatsoever — it is a reversible encoding with no key, and any decoder will read it. Never use it to hide passwords, tokens or personal data. If you need confidentiality you need actual encryption, and if you need to verify integrity you want a hash instead.
Why does the output end in one or two equals signs?
Base64 works on groups of three bytes. When the input length is not a multiple of three, the final group is padded so the output still divides into four-character blocks. One leftover byte produces two equals signs, two leftover bytes produce one. The URL-safe variant usually omits padding entirely.
What is URL-safe Base64 and when do I need it?
Standard Base64 uses plus and slash, both of which have meaning inside a URL and get percent-encoded when they appear in a query string or path. The URL-safe alphabet substitutes hyphen and underscore so the value can be dropped into a URL untouched. JSON Web Tokens use this variant for every segment.
How much bigger does Base64 make my data?
Roughly one third larger: every three bytes become four characters, plus padding. A 90 KB image becomes about 120 KB as a data URI. That trade is worth it for a small icon you want to inline, and rarely worth it for anything large.
My decoded text looks like garbage. What went wrong?
Usually the original bytes were not UTF-8 text at all — decoding a Base64-encoded PNG will produce nonsense in a text pane, because it is not text. The other common cause is a truncated string: Base64 must arrive complete, since the final characters carry the last bytes.
Can I encode an image or a PDF here?
This page works on text. To turn a file into a data URI, use the image to Base64 tool instead, which reads the file locally and hands back a ready-to-paste data URI.