Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to text. Supports UTF-8 characters, auto-detection mode, and real-time conversion. All processing happens in your browser.

Runs in your browser
Loading...

How It Works

Enter Text

Paste your text or Base64 string in the input area.

Choose Mode

Select Encode, Decode, or Auto-Detect mode based on your input.

Copy Result

Copy your encoded or decoded result with one click.

Features

UTF-8 Support

Properly handles Unicode characters including emoji, Chinese, Japanese, and more.

Auto-Detection

Automatically detects whether your input is text or Base64 encoded.

Real-Time Conversion

Enable live conversion as you type for instant feedback.

100% Private

All processing happens in your browser. Nothing is sent to any server.

What is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 characters (A-Z, a-z, 0-9, +, /). It's commonly used to encode binary data like images or files for transmission over text-based protocols.

How does it work? Base64 takes every 3 bytes (24 bits) of input and converts them to 4 characters (6 bits each). This means encoded data is about 33% larger than the original. The "=" padding characters at the end indicate the original data length wasn't divisible by 3.

Common uses: Embedding images in HTML/CSS (data URIs), encoding email attachments (MIME), storing binary data in JSON/XML, and passing data in URLs.

Common Use Cases

  • Data URIs: Embed images directly in HTML or CSS without external files.

  • API Authentication: Encode credentials for HTTP Basic Authentication headers.

  • Email Attachments: MIME uses Base64 to encode binary attachments in emails.

  • JWT Tokens: JSON Web Tokens use Base64URL encoding for the header and payload.

  • Debugging: Decode Base64 strings from logs or API responses to read the content.

Frequently Asked Questions

Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It's commonly used to encode binary data for transmission over text-based protocols like HTTP, email (MIME), and JSON. Base64 increases the data size by approximately 33% because it encodes 3 bytes into 4 characters.

Yes, this Base64 encoder and decoder is completely free with no sign-ups, subscriptions, or limits. More importantly, all processing happens entirely in your browser using JavaScript. Your data never leaves your device - nothing is sent to any server. You can even disconnect from the internet after loading the page and it will still work.

URL-safe Base64 (also called Base64URL) is a variant that replaces + with - and / with _ to make the encoded output safe for use in URLs and filenames. Standard Base64 uses + and / which have special meanings in URLs and can cause problems in file paths. JWT tokens and many APIs use URL-safe Base64.

Base64 uses = padding to ensure the output length is always a multiple of 4 characters. Since Base64 encodes 3 bytes of input into 4 characters of output, padding is added when the input length isn't divisible by 3. One byte produces 2 characters + '==', two bytes produce 3 characters + '=', and three bytes produce 4 characters with no padding.

Yes! Switch to the File mode to encode any file to Base64. Simply drag and drop a file or click to upload. For images, you'll see a preview of the encoded image. You can also generate data URIs for embedding images directly in HTML or CSS without external file dependencies.

The line breaks option formats the Base64 output with newlines at regular intervals (usually 64 or 76 characters). This is called MIME encoding and is required by some protocols like email (RFC 2045 specifies 76 characters per line). It's also used in PEM certificates (64 characters per line).

Our decoder automatically handles both standard and URL-safe Base64 formats. It also automatically adds padding if it's missing and strips whitespace/line breaks. Just paste your Base64 string and it will be decoded correctly regardless of the variant used.

Base64 is used for: embedding images in HTML/CSS (data URIs), encoding email attachments (MIME), storing binary data in JSON/XML, HTTP Basic Authentication headers, JWT tokens (using Base64URL), encoding cryptographic keys in PEM format, and passing binary data in text-only protocols.