Skip to content

Base64 Decoder & Encoder

Decode and encode Base64 online for free. Real-time conversion with full UTF-8 and emoji support. 100% private — runs in your browser. No signup needed.

No Tracking Runs in Browser Free
Text
Base64

What is Base64?

Base64 is a group of binary-to-text encoding schemes that represent binary data as a string of ASCII characters. Defined in RFC 4648, Base64 divides the input into groups of 3 bytes (24 bits), then splits those 24 bits into four 6-bit groups, each mapped to one of 64 printable characters: A-Z (0-25), a-z (26-51), 0-9 (52-61), + (62), and / (63). The = character pads the output when the input length is not a multiple of 3.

Base64 was originally designed to safely transmit binary data over channels that only support text, such as email (MIME) and early HTTP. Today it is ubiquitous: data URIs embed images in HTML, JWT tokens encode claims, PEM certificates wrap keys, and APIs transport binary payloads in JSON.

A Base64 encoder converts raw bytes to this safe ASCII representation, while a decoder reverses the process. Because each group of 3 input bytes produces 4 output characters, Base64-encoded data is approximately 33% larger than the original.

Use this free online Base64 converter to decode Base64 to text or encode text to Base64 instantly in your browser.

// Encode
btoa('Hello')        // → 'SGVsbG8='

// Decode
atob('SGVsbG8=')     // → 'Hello'

// UTF-8 safe encode
const bytes = new TextEncoder().encode('你好');
btoa(String.fromCharCode(...bytes));
// → '5L2g5aW9'

Key Features

Real-Time Conversion

Encode and decode instantly as you type — no buttons to click, results appear immediately in the other area.

Full UTF-8 Support

Correctly handles Chinese, Japanese, Korean, Arabic, emoji, and any Unicode text via TextEncoder/TextDecoder.

Bidirectional

Type in either area: plain text on the left encodes to Base64 on the right, Base64 on the right decodes to text on the left.

100% Browser-Based

All processing happens locally in your browser. Your data never leaves your device — no server uploads, no tracking.

Error Detection

Invalid Base64 input is detected immediately with a clear error message, so you know exactly what to fix.

One-Click Copy

Copy encoded or decoded results to your clipboard instantly with the Copy button on each side.

Examples

Plain Text

Hello, World!
SGVsbG8sIFdvcmxkIQ==

Simple ASCII text encoded to Base64

UTF-8 Text

你好世界 🌍
5L2g5aW95LiW55WMIPCfjI0=

Chinese characters and emoji with proper UTF-8 encoding

JSON Data

{"user":"alice","role":"admin"}
eyJ1c2VyIjoiYWxpY2UiLCJyb2xlIjoiYWRtaW4ifQ==

Encode JSON payloads for embedding in URLs or headers

Multi-line Text

Line 1
Line 2
Line 3
TGluZSAxCkxpbmUgMgpMaW5lIDM=

Base64 preserves line breaks and whitespace

How to Use

  1. 1

    Enter Text or Base64

    Type or paste plain text in the left area to encode, or paste a Base64 string in the right area to decode. Conversion is instant and bidirectional.

  2. 2

    See Real-Time Results

    The other area updates automatically as you type. Any errors (like invalid Base64) are shown immediately.

  3. 3

    Copy the Result

    Click the Copy button on either side to copy the encoded or decoded result to your clipboard.

Common Use Cases

Data URI Generation
Encode images or files to Base64 for embedding directly in HTML or CSS as data URIs.
JWT Debugging
Decode Base64-encoded JWT token headers and payloads to inspect claims and expiration times.
API Development
Encode binary data for transmission in JSON APIs, or decode Base64 responses for inspection.
Email Encoding
Encode or decode MIME-encoded email content and attachments.
Certificate Inspection
Decode PEM-encoded certificates and keys to examine their binary content.
Configuration Embedding
Encode configuration data or secrets for safe embedding in environment variables or config files.

Technical Details

RFC 4648 Compliant
Implements standard Base64 encoding as defined in RFC 4648, using the A-Z, a-z, 0-9, +, / alphabet with = padding.
UTF-8 Via TextEncoder
Uses the Web API TextEncoder to convert Unicode strings to UTF-8 bytes before encoding, ensuring correct handling of all scripts and emoji.
Browser-Based Processing
All encoding uses native btoa()/atob() with TextEncoder/TextDecoder — no external libraries, no server calls.

Best Practices

Don't Use Base64 for Security
Base64 is encoding, not encryption. Never use it to 'protect' passwords, tokens, or sensitive data — always use proper encryption.
Watch the Size Increase
Base64 adds ~33% overhead. For large files, consider binary transfer instead of Base64 encoding.
Use UTF-8 Encoding
Always encode text to UTF-8 bytes before Base64 encoding to ensure non-ASCII characters (Chinese, emoji) are handled correctly.

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data as a string of printable ASCII characters. It converts every 3 bytes of input into 4 ASCII characters from the set A-Z, a-z, 0-9, +, and /. The '=' character is used for padding when the input length is not a multiple of 3. Base64 is defined in RFC 4648 and is widely used in email (MIME), data URIs, JSON Web Tokens (JWT), and HTTP authentication.
Is my data safe when using this tool?
Yes, completely. All encoding and decoding happens locally in your browser using JavaScript's native btoa(), atob(), TextEncoder, and TextDecoder APIs. Your data never leaves your device — there are no server requests, no cookies, no analytics on your input, and no data storage of any kind.
How does this tool handle non-ASCII characters like Chinese or emoji?
This tool first converts the input text to UTF-8 bytes using the TextEncoder API, then Base64-encodes those bytes. This ensures characters outside the ASCII range — including Chinese (你好), Japanese (こんにちは), Arabic, and emoji (🎉) — are encoded correctly. When decoding, the tool reverses the process: Base64 → bytes → UTF-8 text using TextDecoder.
Is Base64 encryption?
No. Base64 is an encoding, not encryption. It does not provide any security — anyone can decode a Base64 string back to the original data instantly. Base64 is designed for data transport (making binary data safe for text-only channels), not for protecting secrets. If you need to protect data, use proper encryption (AES, RSA) before optionally Base64-encoding the result.
Where is Base64 commonly used?
Base64 is used extensively in: (1) Data URIs — embedding images directly in HTML/CSS as 'data:image/png;base64,...', (2) Email — MIME encoding for attachments and non-ASCII content, (3) JWT — JSON Web Tokens encode header and payload as Base64URL, (4) HTTP Basic Auth — credentials are sent as Base64-encoded 'username:password', (5) APIs — transmitting binary data in JSON payloads, (6) Certificates — PEM format wraps DER-encoded certificates in Base64.
What is the difference between Base64 and URL-safe Base64?
Standard Base64 uses '+' and '/' characters, which have special meaning in URLs. URL-safe Base64 (also defined in RFC 4648) replaces '+' with '-' and '/' with '_', making the output safe for use in URLs and filenames without additional encoding. This tool uses standard Base64. To convert, simply replace + with - and / with _ in the output.
Why does Base64 increase data size?
Base64 encodes 3 bytes of input into 4 characters of output, resulting in approximately 33% size increase. This is because Base64 uses only 64 printable ASCII characters (6 bits each) to represent 8-bit bytes. For example, the 13-character string 'Hello, World!' becomes the 20-character Base64 string 'SGVsbG8sIFdvcmxkIQ=='. This trade-off is acceptable because the encoded data is safe to transmit through text-only protocols.
How do I encode a file to Base64?
On macOS or Linux, use the command line: base64 < myfile.png > myfile.b64. On Windows, use PowerShell: [Convert]::ToBase64String([IO.File]::ReadAllBytes('myfile.png')). In JavaScript (Node.js), use fs.readFileSync('myfile.png').toString('base64'). In Python, use import base64; base64.b64encode(open('myfile.png','rb').read()). This browser tool handles text input; for large binary files, command-line tools are more efficient.
Can I use Base64 in HTML and CSS?
Yes. Base64 is commonly used in data URIs to embed small assets directly in HTML or CSS, eliminating extra HTTP requests. In HTML: . In CSS: background-image: url('data:image/svg+xml;base64,PHN2Zy...'). This is ideal for small icons and SVGs (under ~5 KB). For larger files, separate file references are more efficient because Base64 adds 33% size overhead and bypasses browser caching.
What is the maximum input size?
This browser-based tool efficiently handles text up to about 5 MB. For very large files or binary data, consider using command-line tools like 'base64' (available on macOS and Linux) or 'openssl base64'. The Base64 standard itself has no size limit.
What characters are in the Base64 alphabet?
The standard Base64 alphabet (RFC 4648) consists of 64 characters: uppercase letters A-Z (values 0-25), lowercase letters a-z (values 26-51), digits 0-9 (values 52-61), plus sign + (value 62), and forward slash / (value 63). The equals sign = is used for padding. The URL-safe variant (Base64URL) replaces + with - and / with _ to avoid conflicts with URL-reserved characters.

Related Tools

View all tools →