Convert
Encode and decode base64
Both directions at once: what your text encodes to, and what it decodes to.
Base64 is not encryption. It is a way to carry bytes through something that only accepts text, and anyone can reverse it — which is why it must never stand in for a password or a secret.
The text is encoded as UTF-8 first, so accents, emoji and non-Latin scripts survive the round trip. An implementation that calls btoa on the raw string corrupts anything above U+00FF, which is a common bug in tools that only ever tested English.
Decoding accepts the URL-safe alphabet as well as the standard one and ignores whitespace, because base64 arrives wrapped at 76 characters in email more often than not. Bytes that are not valid UTF-8 are reported rather than turned into replacement characters, since that usually means a file or an image rather than text.
Questions
Is base64 secure?
No. It is reversible by anyone and must not be used to hide a password, a key or anything else secret.
Why is the output longer than the input?
Base64 uses four characters for every three bytes, so the encoded text is about a third longer. That is the cost of the format.
Can I decode an image?
The decoder returns text. An image’s bytes are not valid UTF-8, so it says so instead of printing replacement characters. A base64-to-file converter is a different tool.
Does the URL-safe alphabet work?
Yes. - and _ are accepted and treated as + and /.
More text and code
- Word counterWords, characters, sentences and reading time, counted as you type.
- Case converterTitle Case, sentence case, camelCase, snake_case and the rest, at once.
- JSON formatterValidates JSON and prints it indented, with the parser’s own error.
- URL encoderPercent-encode text, or read what a %-encoded string says.
- Hash generatorSHA-256, SHA-1 and SHA-512 of any text, from the browser’s own crypto.
- UUID generatorFive version-4 UUIDs from the browser’s random source, ready to copy.
- Timestamp converterEpoch seconds, milliseconds, ISO 8601, UTC and your own time zone.
- Colour converterHEX, RGB and HSL from one value, with WCAG contrast ratios.
- Slug generatorA clean URL slug from any title, accents and punctuation handled.
- CSV to JSONRows to objects, with quoted commas, semicolons and tabs handled.
- Text diffTwo texts, line by line: what was added and what was removed.