GitGudgit gud
gitgudRun an audit
‹ all tools
Encodegitgud / tools

Base64 Encode / Decode

UTF-8-safe text ⇄ Base64, plus files and images to data URIs, with a URL-safe alphabet toggle.

Runs entirely in your browser — nothing you paste is uploaded.

About Base64 Encode / Decode

Base64 turns arbitrary bytes into 64 printable ASCII characters so they can travel through channels that only handle text — email bodies, JSON strings, data URIs, HTTP headers. It costs about a third more size and provides exactly no security, which is the misunderstanding worth clearing up first.

Text mode handles UTF-8 properly. The browser's built-in `btoa` throws on any character above U+00FF, which is why so many naive implementations break on an emoji or an accented name. This encodes the text to bytes first, so any string round-trips exactly.

File and image mode takes a drag-and-drop or a file picker, up to 5 MB, and produces a data URI with the correct MIME type — the form you paste into CSS as an inline background or into an `<img src>`. Images get a live preview, and decoding a data URI hands the file back as a download, byte for byte identical.

The URL-safe toggle swaps `+` and `/` for `-` and `_`, which is what JWTs and URL parameters use, and padding can be stripped. Everything runs locally: converting a file makes no network request at all, which is the only sensible property for a tool people feed private keys and internal documents to.

Frequently asked

›Is Base64 encryption?

No, and treating it as such is a recurring security incident. It's an encoding — fully reversible by anyone, with no key. A password stored as Base64 is a plaintext password with an extra step.

›Why does encoding an emoji fail in other tools?

Because `btoa` only accepts characters in the Latin-1 range and throws on anything above it. The fix is to encode the string to UTF-8 bytes before Base64-encoding those bytes, which is what this does — so emoji, CJK text and accented characters all round-trip.

›What is URL-safe Base64?

The RFC 4648 §5 alphabet, which replaces `+` with `-` and `/` with `_` so the result survives being put in a URL or a filename without percent-encoding. JWTs use it, with padding stripped.

›Should I inline images as data URIs?

For small assets — icons, a few hundred bytes of SVG — yes, it saves a request. For anything large, no: a data URI can't be cached separately, is ~33% bigger, and blocks the stylesheet or document it's embedded in from finishing.

›Is my file uploaded when I convert it?

No. The file is read with the browser's `FileReader` and encoded in the tab. No request is made during conversion.

Related tools