Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
Base64 Encoder/Decoder

Base64 Encoder/Decoder

Encode text or files to Base64 and decode Base64 strings back to readable text instantly in your browser.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a sequence of printable ASCII characters. It is widely used in web development, email systems, and data storage to safely transmit binary data through text-based protocols.

This tool lets you encode text or files to Base64 and decode Base64 strings back to their original form — all instantly in your browser with no server processing.

Common Use Cases

Embedding Images

Convert images to Base64 Data URLs for inline embedding in HTML/CSS without external file references

API Authentication

Encode credentials for HTTP Basic Authentication headers in web APIs

Email Attachments

MIME encoding uses Base64 to embed binary attachments in email messages

Data Storage

Store binary data in JSON, XML, or database text fields safely

JWT Tokens

JSON Web Tokens use Base64url encoding for header and payload components

How to Use

Encode Text to Base64

1

Select Mode

Make sure Encode mode is selected (default)

2

Input Text

Type or paste your text in the left panel

3

Get Result

The Base64 result appears instantly in the right panel

4

Save Output

Click Copy or Download to save the result

Decode Base64 to Text

1

Switch Mode

Click Decode to switch mode

2

Paste Base64

Paste a Base64 string in the left panel

3

View Result

The decoded text appears instantly in the right panel. Data URLs (e.g., data:image/png;base64,...) are automatically detected

Encode a File

1

Upload File

In Encode mode, click the Upload button

2

Select File

Select any file — the tool reads and encodes it to Base64

3

Use Result

Copy the result to embed in your code or save as a text file

Available Options

URL-Safe

Replaces + with -, / with _, and removes padding =. Useful for URLs, filenames, and JWT tokens.

Line Wrap

Inserts a line break every 76 characters, following the MIME standard used in email encoding.

Swap

Moves the output to the input and switches mode, so you can quickly verify a round-trip encode/decode.

Features

Real-Time Conversion

Text is encoded or decoded as you type — no need to press a button. Results update instantly with a short delay to keep things smooth.

File Upload Support

Upload any file (images, PDFs, documents) to encode it as a Base64 string. This is useful for embedding assets directly in HTML, CSS, or JSON without external file references.

URL-Safe Base64

Standard Base64 uses +, /, and = characters that can cause issues in URLs and filenames. The URL-safe variant replaces these with -, _, and removes trailing padding — commonly used in JWT tokens and web APIs.

Line Wrapping (MIME)

When enabled, output is wrapped at 76 characters per line following the MIME standard (RFC 2045). This format is used in email encoding and PEM certificates.

Data URL Detection

When decoding, the tool automatically detects and strips Data URL prefixes like data:image/png;base64,..., so you can paste the full Data URL without manually removing the prefix.

Size Statistics

The status bar shows the input size, output size, and the encoding ratio. Standard Base64 encoding increases data size by approximately 33% (ratio ~1.33x).

Your Data Stays Private: All processing happens in your browser. No uploads — files and text never leave your device. No tracking — we don't collect or store any data you encode or decode.

Frequently Asked Questions

What is the difference between Base64 and URL-safe Base64?

Standard Base64 uses +, /, and = characters. URL-safe Base64 replaces + with -, / with _, and removes padding =. This makes the output safe to use in URLs, filenames, and query parameters without additional encoding.

Why does Base64 encoding increase the file size?

Base64 represents 3 bytes of binary data as 4 ASCII characters. This results in approximately 33% size increase (ratio ~1.33x). This is a trade-off for being able to safely transmit binary data through text-only channels.

Can I encode any file type?

Yes. You can encode any file — images, PDFs, audio, video, archives, or any binary file. The tool reads the raw bytes and converts them to Base64 text.

What does Line Wrap do?

Line Wrap inserts a line break every 76 characters, following the MIME standard (RFC 2045). This format is required for Base64 content in email (MIME encoding) and PEM certificates. Most modern applications do not require line wrapping.

Is my data safe?

Yes. All encoding and decoding happens entirely in your browser using JavaScript. No data is sent to any server. You can verify this by using the tool offline after the page loads.

What character encoding is used?

The tool uses UTF-8 encoding by default, which supports all Unicode characters including international text, emoji, and special symbols.

Text
Base64
Error

                

Enter text on the left to encode to Base64

| |
Switch between Encode and Decode mode using the toggle buttons
Enable URL-safe to generate Base64 suitable for URLs and filenames
Enable Line Wrap to break output every 76 characters (MIME standard)
Click Swap to quickly reverse the operation — output becomes input
Upload any file to encode it to Base64 — useful for embedding images in HTML/CSS
Paste a Data URL (e.g., data:image/png;base64,...) — the prefix is automatically detected
All encoding and decoding happens locally in your browser — no data is sent to any server
Want to learn more? Read documentation →
1/8
Start typing to search...
Searching...
No results found
Try searching with different keywords