Base64 Encoder & Decoder

Free online tool to encode and decode text, images, and files to Base64

Text to Base64 Encoder and Decoder

0 chars 0 lines
0 chars

Convert Images and Files to Base64

Drag & drop images or files here

Click to select files or paste from clipboard (Ctrl+V)

Supports PNG, JPG, GIF, WebP, SVG, PDF, and any file type

Convert Base64 to Image or File

Recent Conversions

No conversion history yet. Your recent Base64 conversions will appear here.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a string of printable ASCII characters. It uses a set of 64 characters: uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), and two additional characters (+ and / in standard Base64, or - and _ in URL-safe Base64).

Common Uses for Base64 Encoding

Base64 Encoding Variants

Standard Base64 (RFC 4648)
Uses A-Z, a-z, 0-9, +, / with = padding. The most common variant.
URL-safe Base64
Replaces + with - and / with _ to make the output safe for URLs without additional encoding.
Base64 without padding
Omits the trailing = characters. Useful when the padding is unnecessary or problematic.
MIME Base64
Adds line breaks every 76 characters, as required by email standards (RFC 2045).

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It converts binary data into a set of 64 printable characters (A-Z, a-z, 0-9, +, /), making it safe to transmit over text-based protocols like email or embed in HTML/CSS.

Why does Base64 increase file size by 33%?

Base64 encodes 3 bytes of binary data into 4 ASCII characters. This 4/3 ratio means the encoded output is approximately 33% larger than the original. Additionally, MIME-formatted Base64 adds line breaks every 76 characters, slightly increasing size further.

Is Base64 encryption?

No, Base64 is encoding, not encryption. It does not provide any security or privacy. Anyone can decode Base64 data back to its original form instantly. For security, you should use proper encryption algorithms like AES or RSA.

What is URL-safe Base64?

URL-safe Base64 (also called Base64URL) replaces the + and / characters with - and _ respectively, making the encoded string safe for use in URLs without additional percent-encoding. The padding character = may also be omitted.

How do I embed a Base64 image in HTML?

Use a data URI in the img src attribute: <img src="data:image/png;base64,YOUR_BASE64_STRING">. Replace image/png with the correct MIME type for your image format (image/jpeg, image/gif, image/webp, etc.).

What is the maximum size for Base64 encoding?

There is no inherent size limit for Base64 encoding. However, practical limits exist: browsers may struggle with very large data URIs (typically over 2MB for images), some systems have URL length limits around 2000-8000 characters, and large Base64 strings can impact performance.

How do I decode Base64 in JavaScript?

Use the built-in atob() function: const decoded = atob(base64String);. For Unicode text, first decode with atob, then convert the binary string to UTF-8 using TextDecoder.

When should I use Base64 vs binary files?

Use Base64 when: embedding small images in HTML/CSS, transmitting through text-only channels, or storing in JSON/XML. Use binary files when: file size matters, serving static assets, or working with large files. Base64 adds 33% overhead.