Base64 Encoder & Decoder

Encode any text to Base64, or decode Base64 back to readable text, with full UTF-8 support for accents, non-Latin scripts and emoji. Switch to URL-safe Base64, remove padding or wrap lines at 76 characters. You can also drop in any file or image to get its Base64 or a ready-to-use data URI, and decode Base64 back into a downloadable file, with the file type detected automatically. Nothing is uploaded.

  • 100% free
  • No sign-up
  • Private & local
  • Works on mobile

File or image → Base64

Drop any file to convert it to Base64or browse files · Images, PDFs, fonts, anything. Processed locally.

Private by design: every calculation runs locally in your browser. Nothing you type is sent to a server or stored by us.

What Is Base64?

Base64 is an encoding that represents binary data (any bytes) using only 64 safe, printable characters: A–Z, a–z, 0–9, + and /, with = used for padding. It exists because many systems (email, URLs, JSON, XML, HTTP headers, HTML) were designed for text, and can corrupt raw binary data or special characters. Encoding the data as Base64 lets it travel safely through any text channel and be decoded back into exactly the original bytes.

You'll meet Base64 everywhere in development: email attachments (MIME), data URIs that embed images directly in HTML and CSS, JSON Web Tokens (JWTs), HTTP Basic authentication headers, API payloads carrying files, SSH and TLS keys and certificates (PEM), and configuration secrets in Kubernetes. This Base64 encoder and decoder handles all of these, in your browser.

Important: Base64 is an encoding, not encryption. Anyone can decode it instantly, so never use it to hide passwords or secrets.

How to Encode or Decode Base64

  1. Choose the mode: encode text to Base64, or decode Base64 to text.
  2. Type or paste your input. The result appears instantly, and you can also drop a text file.
  3. For encoding, choose URL-safe output, padding and 76-character line wrapping if your system needs them.
  4. For decoding, standard and URL-safe Base64, missing padding, line breaks and even full data URIs are all accepted. If the result is binary, such as an image or PDF, the type is detected and you can download the file.
  5. To convert a file, drop it into the file area to get its Base64 string or a data URI.

How Base64 Works

Base64 takes the input 3 bytes (24 bits) at a time and splits them into four 6-bit groups. Each group is a number from 0 to 63, mapped to one character of the alphabet. For example, the text "Man" is the bytes 77, 97, 110, or 01001101 01100001 01101110 in binary. Regrouped into 6 bits, that's 010011 010110 000101 101110 = 19, 22, 5, 46, which encodes to TWFu. When the input length isn't a multiple of 3, = padding fills the final group. Because 3 bytes become 4 characters, Base64 output is always about 33% larger than the original.

VariantCharacters 62 and 63PaddingUsed in
Standard (RFC 4648)+ /YesEmail, data URIs, most APIs
URL-safe (Base64url)- _Usually omittedJWTs, URLs, file names
MIME+ /Yes, lines wrapped at 76Email attachments

Text Encoding and UTF-8

Base64 encodes bytes, not characters, so text must first be converted to bytes. This tool always uses UTF-8, the standard for the web, so accented letters, Chinese, Arabic and emoji all round-trip correctly. The browser's built-in btoa() function fails on any character above U+00FF. That's a common bug this tool avoids by encoding through TextEncoder first.

Data URIs for Images

A data URI embeds a file directly in HTML or CSS, like <img src="data:image/png;base64,iVBOR…">. It saves an HTTP request, which is useful for tiny icons, email templates and single-file demos. Because of the 33% size overhead and the lack of separate caching, use data URIs only for small assets, typically under a few kilobytes.

Base64 in Everyday Development

You'll often need Base64 for HTTP Basic authentication (the header is Basic followed by Base64 of username:password), for embedding small images and fonts in CSS, for sending files inside JSON APIs, and for reading Kubernetes secrets, which are stored Base64-encoded. In JavaScript, use TextEncoder with btoa for Unicode-safe encoding, or Buffer.from(text).toString('base64') in Node.js. On the command line, base64 (Linux/macOS) and certutil -encode (Windows) do the same job.

Frequently Asked Questions

How do I encode Base64 on the command line?

On Linux or macOS, run echo -n "text" | base64. On Windows PowerShell, use [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("text")).

Is Base64 secure?

No. It's reversible encoding with no key. Use real encryption to protect data.

Why does my Base64 end with = or ==?

Padding. One = means the last group had 2 bytes, and == means it had 1 byte.

How do I decode Base64 to an image?

Paste the Base64 or data URI in decode mode. Images are detected, previewed and can be downloaded.

Why do I get an "invalid character" error?

The input contains characters outside the Base64 alphabet, often a stray quote or a truncated copy.

Are my files uploaded?

No. Encoding and decoding happen entirely in your browser.