Command Palette

Search for a command to run...

Developer Tool

Base64 Encode / Decode

Encode text to Base64 or decode Base64 to text. Supports UTF-8 and file-to-Base64 conversion.

About Base64 Encode / Decode

A Base64 encoder/decoder converts data between raw text/binary and Base64 encoding. Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It is commonly used to encode data for transmission over media that only support text, such as embedding images in HTML/CSS, sending binary data in JSON, and encoding authentication credentials in HTTP headers.

How to Use

For encoding: paste your text or data into the input area and click 'Encode'. For decoding: paste your Base64 string and click 'Decode'. The result appears instantly. You can also encode/decode URLs (URL-safe Base64 replaces + with - and / with _) and handle UTF-8 text automatically. The output can be copied to clipboard with one click.

Formula / Key Equations

Base64 encoding converts every 3 bytes of input into 4 Base64 characters. If the input length is not a multiple of 3, padding characters (=) are added. The encoding table maps 6-bit values to 64 printable ASCII characters. Base64 increases data size by approximately 33% compared to the original binary data.

Common Use Cases

Embedding small images directly in HTML or CSS using data URIs (data:image/png;base64,...). Encoding authentication credentials for HTTP Basic Auth (username:password). Storing binary data in JSON or XML text fields. Encoding email attachments in MIME format. Passing binary data through text-only protocols. Creating favicon data URIs.

Limitations

Base64 is an encoding scheme, not encryption — it provides no security or confidentiality. Anyone can decode Base64 data. Very large files (over 50MB) may cause browser performance issues. The tool handles UTF-8 text encoding but may not correctly process all binary file types. Line breaks in Base64 (MIME format) are handled automatically.

Frequently Asked Questions

Is Base64 the same as encryption?

No. Base64 is encoding, not encryption. It simply converts data to a different representation that uses only ASCII characters. Anyone can easily decode Base64 data — it provides zero security. For actual encryption, use AES, RSA, or other cryptographic algorithms.

Why does Base64 increase file size by 33%?

Base64 uses 4 characters to represent every 3 bytes of data (4/3 = 133% of original size). This is because Base64 only uses 6 bits per character (64 values) while the original data uses 8 bits per byte. The tradeoff is that Base64 data can be transmitted through any text-based channel.

What is URL-safe Base64?

URL-safe Base64 replaces the + character with - and / with _, removing characters that have special meaning in URLs. The padding character = is also often removed. This variant is commonly used in web tokens (JWT), URL parameters, and filenames where standard Base64 characters would cause issues.

Can I encode files (images, PDFs) to Base64?

Yes. Read the file as binary data, convert to Base64, and you get a text representation of the entire file. This is commonly done for small images embedded in web pages. However, large files should not be Base64-encoded as the 33% size increase and memory requirements make it impractical.

What is a data URI?

A data URI is a URL scheme that includes data inline: data:[mediatype][;base64],data. For example, data:image/png;base64,iVBORw0KGgo... embeds a PNG image directly in HTML/CSS without needing a separate file. Our tool produces Base64 output that can be used in data URIs.

Related Tools