iformat.io Logo iformat.io
iformat.io Logo iformat.io

Free Base64 Encode & Decode

Encode text or files to Base64, or decode Base64 strings back to plain text. Supports UTF-8, URL-safe mode, and file encoding — all processed in your browser.

Encode a File to Base64

Drop a file or

Base64 in practice: variants, size, when to use it

There are two Base64 variants you'll actually encounter. Standard Base64 (RFC 4648 §4) uses + and / in the output alphabet, plus = for padding — fine inside JSON, XML, or email, broken in URLs because all three characters have reserved meanings there. Base64url (RFC 4648 §5) swaps +-, /_, and often drops the padding — that's what JWTs, WebAuthn credentials, and modern APIs use. Decoding a Base64url string with a standard decoder usually fails silently or returns garbage; the tool auto‑detects both.

The size cost is fixed: encoded output is always 4/3× the input, rounded up, so 1 MB of binary becomes 1.33 MB of Base64. That's why embedding small icons as data:image/png;base64,… in CSS is fine but embedding a hero image is a mistake — you pay the size tax on every request that pulls the stylesheet, and browsers can't parallelize downloads for inline resources. As a rule of thumb: inline anything under about 2 KB, ship anything larger as a real file.

Base64 is not encryption. It's a transport encoding — designed to survive channels that mangle non‑printable bytes (SMTP, older HTTP proxies, terminal paste buffers). If you find "encrypted" credentials in Base64, they're just obfuscated; decode reveals plaintext.

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It uses 64 printable characters (A-Z, a-z, 0-9, +, /) plus = for padding. Base64 increases data size by roughly 33% but ensures safe transport through text-only channels like email, JSON, XML, and URLs.

When should I use Base64 encoding?

Base64 is commonly used to embed images in HTML or CSS as data URIs, encode binary attachments in email (MIME), transmit binary data in JSON or XML payloads, store small files in databases as text, and encode credentials for HTTP Basic Authentication headers.

What is a data URI and how does Base64 relate to it?

A data URI embeds file content directly in HTML or CSS using the format data:[mediatype];base64,[encoded-data]. This eliminates a separate HTTP request for the resource. Common uses include embedding small images, fonts, and SVG icons. This tool generates the full data URI prefix automatically when you encode a file.

How does Base64 work in email attachments?

Email protocols like SMTP only support 7-bit ASCII text. MIME (Multipurpose Internet Mail Extensions) uses Base64 to encode binary attachments such as images, PDFs, and documents so they can travel through email servers safely. MIME-formatted Base64 inserts a line break every 76 characters, which you can enable with the line breaks option in this tool.

What is URL-safe Base64?

Standard Base64 uses + and / characters which have special meaning in URLs. URL-safe Base64 (also called base64url per RFC 4648) replaces + with - and / with _, and optionally removes = padding. This variant is used in JWTs (JSON Web Tokens), URL parameters, and filename-safe encodings.

Can I encode files to Base64?

Yes. Use the file upload section to select any file from your device. The tool reads the file in your browser, converts its binary content to a Base64 string, and generates a data URI with the correct MIME type prefix. This works for images, PDFs, fonts, audio files, and any other file type.

Is there a size limit for Base64 encoding?

There is no strict limit since all processing happens in your browser. However, very large files (over 50 MB) may be slow depending on your device's memory and processing power. For the smoothest experience, files under 10 MB work best. Keep in mind that Base64 output is about 33% larger than the original binary data.

Is my data private when using this tool?

All encoding and decoding happens entirely in your browser using JavaScript. Your text and files are never sent to any server or third party. This makes the tool safe for encoding API keys, configuration files, credentials, and any other sensitive data.
Reviewed by Editorial team Updated