Davirix

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 back to readable text in real-time. Supports URL-safe mode, UTF-8, and file uploads — all processing happens in your browser.

Real-time ConversionEncode & DecodeURL-safe ModeUTF-8 Support100% Browser-sideAuto Convert
Plain Text
1
Base64 Output

Enter text to encode

Or click Sample to try with example data

Ready

Free & open tool — no signup required. Your data never leaves your browser.

What Is Base64 Encoding?

Base64 is a group of binary-to-text encoding schemes that represent binary data as a string of printable ASCII characters. It uses a set of 64 characters — A-Z, a-z, 0-9, and two symbols (+ and / in standard, or - and _ in URL-safe variant) — to encode any binary data into text form. The encoding is widely used in web development for embedding images, transmitting data in JSON/XML, encoding email attachments (MIME), and storing complex data in URLs or cookies.

How Base64 Encoding Works

  1. 1Input bytes are grouped into blocks of 3 bytes (24 bits). If the input length isn't divisible by 3, it's padded with zeros.
  2. 2Each 24-bit block is split into four 6-bit values (0-63), each mapped to a character in the Base64 alphabet.
  3. 3Padding characters (=) are added at the end if the original input wasn't evenly divisible by 3. One = means 1 byte of padding, == means 2 bytes.

When to Use Base64

Data URIs

Embed small images, fonts, or files directly in HTML or CSS using data:image/png;base64,... syntax.

API payloads

Safely transmit binary data (files, images, certificates) within JSON or XML payloads.

Email attachments

MIME encoding uses Base64 to encode email attachments for safe transport over text-only protocols.

Authentication tokens

JWTs and HTTP Basic Auth use Base64 (or URL-safe variant) to encode header and payload data.

Configuration files

Store binary secrets, certificates, or keys in text-based configuration formats like YAML or .env files.

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into a set of 64 printable ASCII characters. It's commonly used to transmit data over channels that only support text, such as embedding images in HTML/CSS, sending data in JSON APIs, or encoding email attachments (MIME).
Is my data safe when using this tool?
Yes. This Base64 tool runs entirely in your browser using JavaScript. Your data is never transmitted to any server. No cookies, no analytics, no storage — everything stays on your device.
What is URL-safe Base64?
Standard Base64 uses '+' and '/' characters which have special meaning in URLs. URL-safe Base64 replaces '+' with '-' and '/' with '_', and optionally removes trailing '=' padding. This variant is used in JWTs, data URIs in URLs, and filename-safe encodings.
Why does Base64 increase the size?
Base64 encodes 3 bytes of binary data into 4 ASCII characters, resulting in approximately 33% size increase. This is the trade-off for being able to represent binary data using only text-safe characters.
Can I encode files with this tool?
Yes. Click the 'File' button to upload any file. In Encode mode, the file is read as binary and converted to Base64. In Decode mode, a text file containing Base64 is read and decoded. For large files (>5MB), processing may take a moment.
What's the difference between Base64 and URL encoding?
Base64 converts binary data to text using 64 characters. URL encoding (percent encoding) replaces unsafe URL characters with '%XX' hex values. They serve different purposes: Base64 is for data transport, URL encoding is for making URLs safe. They can be used together — e.g., URL-encoding a Base64 string for use in a query parameter.

Related Tools