FlowToolkit
Dev

Base64 Encoder / Decoder

Encode and decode Base64 text and files, with optional URL-safe variant.

Loading tool…

About this tool

Encode plain text to Base64 or decode Base64 back to text, with UTF-8 safety. Encode binary files to base64 data URLs for inlining. Toggle URL-safe encoding (base64url with `-` and `_`, no padding) for tokens and JWTs.

What Base64 is for

Base64 is a way to represent arbitrary binary data using only 64 printable ASCII characters. It was invented for email at a time when SMTP could not reliably carry 8-bit binary bytes, and it has since become the default encoding for embedding small binaries in text formats: images inlined in HTML and CSS via data: URLs, attachments in JSON-based APIs, JWT headers and payloads, and credentials passed in HTTP Basic Authentication headers.

Standard vs URL-safe

Standard Base64 uses the characters A-Z, a-z, 0-9, plus (+), and slash (/), with equals (=) as padding. The plus and slash characters have special meaning in URLs and filenames, which makes the standard variant inconvenient for tokens. The URL-safe variant (RFC 4648) substitutes minus (-) and underscore (_) for those two characters, and the padding is usually stripped. Toggle the option in the tool to switch between the two.

File encoding

Click "Encode file..." to convert any file (image, PDF, font, JSON) into a Base64 data URL with the correct MIME prefix. The result is ready to paste into an HTML img tag, a CSS background, or a JSON field. Because everything runs locally, even large files stay in your browser.

Frequently asked questions

What does URL-safe mean?

In URL-safe Base64 (RFC 4648), `+` becomes `-`, `/` becomes `_`, and padding `=` is typically stripped. This avoids characters that have special meaning in URLs and filenames. JWTs use URL-safe Base64.

Can I encode an image to base64?

Yes. Click "Encode file..." to encode any file — image, PDF, font, JSON — into a Base64 data URL with the correct MIME prefix, ready to paste into HTML or CSS.

How do I decode a base64 string?

Paste the Base64 string into the input area and the decoded text appears instantly. UTF-8 strings are handled correctly, including emoji and non-ASCII characters.

Why does my decoded base64 look corrupted?

Usually because the encoding was URL-safe and the decoder expected standard, or vice versa. Toggle the URL-safe option to match. Also check for trailing whitespace that breaks decoding.

How do I encode text in UTF-8 to Base64?

The encoder handles UTF-8 transparently. Type or paste any text — including emoji, accented characters, Chinese, Arabic — and the encoded output uses the UTF-8 byte representation.

Is Base64 encryption?

No. Base64 is encoding, not encryption. Anyone who sees a Base64 string can decode it back to the original. Never use Base64 to hide secrets — use proper encryption like AES-GCM.