Free Online Tool

Base64 Encoder & Decoder

Convert text, images, and files to Base64 format instantly. Supports URL-safe encoding, Data URI generation, live encoding, and image preview — completely free and private, no server upload.

100% Client-Side No Limits Private
0characters
0 Bbytes
0lines
Encoding Options
Ready — all processing happens locally in your browser.
Encoded/decoded result will appear here...
0characters
0 Bbytes
+0.0% sizechange
🖼️ Image Preview
Decoded Base64 image preview

Powerful Base64 Features

Everything you need to encode and decode Base64 strings efficiently.

⚡

Instant Conversion

Real-time encoding and decoding as you type. No server requests — everything runs in your browser.

📁

Any File Type

Support for images, PDFs, documents, audio, video and binary files. Browser processing supports large files subject to available memory.

🔗

URL-Safe Mode

Generate URL-safe Base64 strings that work in URLs and filenames without encoding issues.

🖼️

Data URI Support

Generate Data URIs for embedding images directly in HTML, CSS, or JavaScript.

🔒

100% Private

All processing happens locally in your browser. Your data — including files and images — never leaves your device.

📋

Multiple Export Formats

Export as plain Base64, HTML img tag, CSS background-image, or Markdown image syntax.

Common Use Cases for Base64

🌐

Embed Images in HTML

Include small images directly in HTML without additional HTTP requests for faster page loads.

🎨

CSS Background Images

Embed icons and small graphics in CSS files to reduce the number of image requests.

📧

Email Attachments

Encode files for safe transmission through email systems that support MIME text encoding.

🔌

API Data Transfer

Send binary data through JSON APIs and web services that expect string values.

💾

Database Storage

Store small files and images as text in databases that do not support binary fields directly.

🔐

Authentication Tokens

Encode credentials and tokens for HTTP Basic Authentication and JWT-style Base64url payloads.

Base64 Character Set

Base64 uses 64 characters to represent binary data. Each character represents 6 bits of data.

Value Char Value Char Value Char Value Char
0 A 16 Q 32 g 48 w
1 B 17 R 33 h 49 x
2 C 18 S 34 i 50 y
3 D 19 T 35 j 51 z
4 E 20 U 36 k 52 0
5 F 21 V 37 l 53 1
6 G 22 W 38 m 54 2
7 H 23 X 39 n 55 3
8 I 24 Y 40 o 56 4
9 J 25 Z 41 p 57 5
10 K 26 a 42 q 58 6
11 L 27 b 43 r 59 7
12 M 28 c 44 s 60 8
13 N 29 d 45 t 61 9
14 O 30 e 46 u 62 +
15 P 31 f 47 v 63 /
Padding: The = character is used for padding when the input length is not divisible by 3.
URL-Safe: In URL-safe Base64, + becomes - and / becomes _

Base64 Encoding — Complete Developer Guide

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a set of 64 ASCII characters (A–Z, a–z, 0–9, +, /). It was designed to safely transmit binary data through systems that only support text, such as email (MIME), URLs, and XML. The name “Base64” comes from its 64-character alphabet.

How Base64 Works

Step Description
1. Group bytes Take 3 bytes (24 bits) of input at a time.
2. Split bits Divide 24 bits into four 6-bit groups.
3. Map chars Map each 6-bit value (0–63) to a Base64 character.
4. Pad Add = padding if the input is not divisible by 3.
Result Output is approximately 33% larger than the original binary input.

Standard vs URL-Safe Base64

Feature Standard URL-Safe
Character 62 + -
Character 63 / _
Safe in URLs No — needs encoding Yes — no encoding needed
Safe in filenames Not universally Yes
Use case Email, general data URLs, JWT, filenames

Base64 Size Overhead

Formula: Output size = ⌈Input bytes / 3⌉ × 4

Recommendation: Only embed files under about 10 KB as Data URIs — larger files can significantly increase page weight.

When to Use Base64

Base64 is NOT Encryption

Base64 provides zero security. Anyone can decode Base64 instantly. It is an encoding scheme, not protection. If you need confidentiality, use appropriate encryption first, then optionally Base64 encode the encrypted output for transmission.

💡 Pro Tips for Base64 Encoding

  1. Use Data URIs only for small files: larger embedded files increase HTML/CSS size.
  2. Always use URL-safe mode for JWTs: JWT uses Base64url.
  3. Enable MIME line breaks for email: RFC 2045 specifies lines no longer than 76 characters for MIME Base64.
  4. Decode Base64 images directly: paste image Base64 in Decode mode to preview supported images.
  5. Use the HTML export for quick embedding: Copy as HTML gives a ready-to-paste image tag.
  6. Check the size comparison panel: compare original and encoded sizes before choosing Data URIs.
  7. Drag and drop for fastest workflow: drop a file directly onto the tool to encode it locally.

Frequently Asked Questions

Common questions about Base64 encoding, decoding, and this tool.

Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters. It takes 3 bytes (24 bits) and maps them to 4 Base64 characters (6 bits each), making output approximately 33% larger while remaining suitable for text-only systems.

No. Base64 is encoding, not encryption. It provides no confidentiality and can be decoded by anyone. Use encryption when the data must remain secret.

Base64 is useful when binary data needs to travel through text-only systems such as JSON, email/MIME, HTML, CSS, URLs and some API formats.

Three 8-bit bytes become four 6-bit Base64 characters. That mathematical representation produces roughly 4/3 the original size, or about 33% overhead before any additional formatting.

URL-safe Base64 replaces + with - and / with _. Many URL-safe implementations also omit trailing = padding. This is commonly called Base64url.

A Data URI embeds data directly in a URI, such as data:image/png;base64,..., allowing a small image or other resource to be placed directly in HTML, CSS or JavaScript.

Base64 can represent any binary data, so images, PDFs, documents, archives, audio, video and other files can be encoded. Browser memory and local device limits determine practical file size.

The processing in this page is performed locally in your browser. The page does not upload your text or selected files to a Base64 generation server.

The tool is browser-based, so practical limits depend on available memory and browser capabilities rather than a server upload limit. For reliable browser operation, use reasonable file sizes and avoid unnecessarily large Data URIs.

Yes. Paste a Data URI or supported image Base64 into Decode mode and the page can display an image preview. Decoded text can be downloaded directly as a text file.

Related Developer Tools

View All Tools

More free tools to supercharge your workflow.