Skip to content

Base64 encoder / decoder

Encode text to Base64 or decode a Base64 string back to readable text. Supports UTF-8 characters and data URLs — runs entirely in your browser.

What is Base64?

Base64 is an encoding scheme that converts binary data into a text representation using 64 printable ASCII characters. It was originally designed for email (MIME) but is now used everywhere — embedding images in HTML/CSS, encoding API tokens, passing binary data through JSON, and building data URLs.

When to use Base64 encoding

  • Embedding small images or icons directly in HTML or CSS via data URLs
  • Encoding binary data for JSON payloads or API requests
  • Passing data through systems that only support ASCII text
  • Creating inline attachments in email (MIME encoding)
  • Encoding credentials for HTTP Basic authentication headers

How encoding works

Base64 takes every 3 bytes (24 bits) of input and splits them into four 6-bit groups. Each group maps to one of 64 characters (A-Z, a-z, 0-9, +, /). If the input isn't a multiple of 3 bytes, the output is padded with = characters. This means Base64 output is always about 33% larger than the input.

Work with encoded data in Basedash

If you store Base64-encoded data in your database, Basedash can display and query it alongside your other columns. Connect to PostgreSQL, MySQL, MongoDB, or 750+ other sources and explore your data visually — no manual decoding needed.

FAQ

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It uses 64 characters (A-Z, a-z, 0-9, +, /) plus = for padding. It's commonly used to embed binary data in text-based formats like JSON, HTML, email, and URLs.

Is my data sent to a server?

No. The entire encoding and decoding runs in your browser using the built-in btoa() and atob() functions. Your data is never transmitted, logged, or stored anywhere.

Does this support UTF-8?

Yes. The tool properly handles Unicode/UTF-8 text by using TextEncoder and TextDecoder to convert between UTF-8 bytes and Base64. This works for characters beyond the ASCII range, including emoji, CJK characters, and accented letters.

What is a data URL?

A data URL has the format data:[mediatype];base64,[data]. It lets you embed file content directly in HTML or CSS without a separate HTTP request. The tool can generate data URLs from your Base64 string with a specified MIME type.

Why is my Base64 output longer than the input?

Base64 encoding increases the size of data by approximately 33% because it represents each 3 bytes of input as 4 ASCII characters. This overhead is the trade-off for having a safe text representation of binary data.

Can I encode files?

This tool is designed for text input. For encoding files (images, PDFs, etc.) to Base64, you'd need a tool that reads the file's binary content. However, you can paste the result of a file-to-Base64 conversion here to decode it back to text.

Query and visualize your data instantly

Connect your database and describe what you need. Basedash handles the query, chart, and dashboard.