Base64 Encoder & Decoder

Convert text, images and any file to Base64 — or decode Base64 back to readable text or the original file. Live results, clear error messages and one-click Data URI, HTML and CSS snippets. Everything runs in your browser.

  • 100% private — nothing is uploaded
  • Text, images & batch files
  • UTF-8 + 14 charsets
  • Standard · URL-safe · MIME
Popular:

TextBase64

Waiting for input

Base64Result

Your Base64 appears hereThe decoded text or file appears here

Type or paste on the left, drop a file anywhere on the page or .

100% private — nothing is uploaded

Nothing to show yet

How it works

Encode or decode Base64 in three steps

No sign-up, no upload, no limits on how often you use it.

  1. 1

    Choose Encode or Decode

    Encode turns text or files into Base64. Decode turns Base64 back into text or the original file — images, PDFs, ZIPs and more.

  2. 2

    Type, paste or drop

    Paste text, Base64 or a data: URI, drop files anywhere on the page or paste a screenshot. The result appears instantly as you type.

  3. 3

    Copy or download

    Copy the result, download it, grab a ready-made Data URI, HTML or CSS snippet, or download many files at once as a ZIP.

Why this Base64 tool

More than btoa() — built for real-world data

Handles emoji, accented letters, big files and messy input that other converters choke on.

Private by design

Text and files are processed in a Web Worker on your device. A strict security policy blocks the page from sending your data to any server.

Every character, every charset

UTF-8 by default (emoji and accents work), plus UTF-16, Windows-1252, ISO-8859-1/-15, Windows-1250/1251 and more for legacy systems.

Images & Data URIs

Turn images, fonts or any file into Data URI, HTML <img>, CSS background or @font-face code — and preview decoded images instantly.

Batch files & ZIP

Encode or decode dozens of files at once. The file type of decoded data is detected automatically; download everything as one ZIP.

Errors you can understand

Invalid character, missing data or bad padding? You see the exact position and a plain-language explanation — not just “invalid input”.

Forgiving input

Line breaks, spaces, quotes, data: prefixes, missing “=” and both alphabets are handled automatically. Strict RFC 4648 mode is one click away.

All the variants

Standard, URL-safe (Base64URL for JWT and links), with or without padding, MIME 76-character lines or PEM 64 — with LF or CRLF.

Your way

Hex input and hex dump, each line separately, dark mode, font size and layout — your settings are remembered on this device.

What is Base64?

Base64 is a way to write any binary data — an image, a PDF, an encryption key — using only 64 “safe” characters: A–Z, a–z, 0–9, + and /, with = as padding. Because the result is plain ASCII text, it can travel through systems that were designed for text only: email, JSON, XML, HTML, URLs and HTTP headers.

Base64 is encoding, not encryption. Anyone can decode it, so it does not protect secrets. It simply makes data transportable. The format is defined in RFC 4648; e-mail (MIME) uses the same alphabet with line breaks every 76 characters (RFC 2045).

How Base64 encoding works

The encoder takes 3 bytes (24 bits) at a time, splits them into four groups of 6 bits and maps each group (0–63) to one character of the alphabet. Here is the word “Man”:

Step1234
TextMan
Byte value7797110
Bits (8 per byte)010011010110000101101110
Bits (6 per character)010011010110000101101110
Index (0–63)1922546
Base64TWFu

So “Man” becomes TWFu. When the input length is not a multiple of three, the last group is filled with zero bits and one or two = signs are added: “Ma” → TWE=, “M” → TQ==.

Base64 variants

VariantCharacters / ruleUsed in
Standard (RFC 4648 §4)A–Z a–z 0–9 + / and =JSON APIs, XML, databases, most programming languages
URL-safe (Base64URL, §5)A–Z a–z 0–9 - _ usually without =JWT tokens, URLs, file names, OAuth, WebAuthn
MIME (RFC 2045)Standard, max 76 characters per line, CRLFE-mail attachments (SMTP), S/MIME
PEM (RFC 7468)Standard, 64 characters per line + BEGIN/END linesTLS certificates, SSH and PGP keys
Data URI (RFC 2397)data:[type];base64,[data]Images and fonts embedded in HTML, CSS, SVG, e-mail

Common uses

  • Embedding images in HTML, CSS or e-mails as Data URIs to save an HTTP request (best for small icons under ~10 KB).
  • Sending files through JSON or XML APIs — e.g. uploading a document or a signature image in a REST request.
  • Reading JWT tokens: the header and payload are Base64URL-encoded JSON. Paste one part here to read it.
  • HTTP Basic authentication: the Authorization header contains user:password in Base64.
  • Certificates and keys (PEM files), Kubernetes secrets and many configuration values are stored as Base64.

How much bigger does Base64 make data?

Base64 output is always about 33% larger than the input: every 3 bytes become 4 characters. The exact length is 4 × ⌈n / 3⌉ characters (without line breaks). With MIME line breaks it is about 37% larger.

OriginalBase64With MIME line breaks
1 KB (1,024 bytes)1,368 characters≈ 1.4 KB
100 KB≈ 133 KB≈ 137 KB
1 MB≈ 1.33 MB≈ 1.37 MB
10 MB≈ 13.3 MB≈ 13.7 MB

Is Base64 secure?

No — Base64 hides nothing. Never use it to “protect” passwords or personal data; use real encryption (for example AES or TLS) instead. What is safe is this tool: your data is encoded and decoded locally in your browser and is never uploaded, which matters when you work with tokens, keys or customer files.

Base64 in code

Tip: in JavaScript, btoa() only accepts Latin-1 and fails on emoji or “€” — convert the text to UTF-8 bytes first, as shown below.

LanguageEncodeDecode
JavaScriptbtoa(String.fromCharCode(...new TextEncoder().encode(s)))new TextDecoder().decode(Uint8Array.from(atob(b), c => c.charCodeAt(0)))
Node.jsBuffer.from(s, 'utf8').toString('base64')Buffer.from(b, 'base64').toString('utf8')
Pythonbase64.b64encode(s.encode()).decode()base64.b64decode(b).decode()
PHPbase64_encode($s)base64_decode($b, true)
JavaBase64.getEncoder().encodeToString(bytes)Base64.getDecoder().decode(b)
C#Convert.ToBase64String(bytes)Convert.FromBase64String(b)
Gobase64.StdEncoding.EncodeToString(data)base64.StdEncoding.DecodeString(b)
Linux / macOSbase64 -w 0 file.binbase64 -d file.txt > file.bin
PowerShell[Convert]::ToBase64String([IO.File]::ReadAllBytes("f.bin"))[IO.File]::WriteAllBytes("f.bin", [Convert]::FromBase64String($b))

Tips

  • Keyboard: Ctrl+Enter converts, Ctrl+Shift+Enter swaps input and result, Ctrl+S downloads (⌘ on Mac).
  • Garbled accents after decoding (e.g. “é” instead of “é”)? The data was probably created with another charset — choose Windows-1252 or ISO-8859-1 in the Charset menu.
  • JWT: paste only the middle part (between the two dots) and decode — the tool understands the URL-safe alphabet and missing padding automatically.
  • Screenshots: press Ctrl+V anywhere on the page to turn a copied image into a Data URI.
  • Large images make HTML and CSS heavy. For anything above a few kilobytes, a normal image file (compressed with our Image Compressor) loads faster.
FAQ

Frequently asked questions

Can’t find an answer? Contact us via the link in the footer.

Is this Base64 encoder free?

Yes. It is completely free, with no sign-up, no watermark and no daily limits.

Are my text and files uploaded?

No. Encoding and decoding run in your browser, inside a Web Worker. The page’s security policy even blocks it from sending your data anywhere. You can disconnect from the internet after the page has loaded and the tool keeps working.

How do I decode Base64?

Click Decode and paste the Base64. The result appears instantly. If it is text you see it directly; if it is a file (image, PDF, ZIP …) the type is detected and you can preview or download it. Spaces, line breaks and data: prefixes are ignored automatically.

How do I convert an image to Base64?

Choose Encode → Files (or the “Image → Base64” shortcut), drop your images and pick the output: plain Base64, Data URI, HTML <img>, CSS background or Markdown. Copy it or download all results as a ZIP.

How do I turn Base64 back into an image or PDF?

Choose Decode and paste the Base64 (with or without the data:image/…;base64, prefix). The tool recognises PNG, JPG, GIF, WebP, SVG, PDF, ZIP, MP3, MP4 and many more, shows a preview and downloads the file with the right extension.

Why do I see strange characters like “é” after decoding?

The Base64 was created from text in a different character set than the one used to read it. The tool auto-detects UTF-8 and UTF-16; for older data select Windows-1252, ISO-8859-1 or another charset in the Charset menu.

What is URL-safe Base64?

A variant (Base64URL, RFC 4648 §5) that uses “-” and “_” instead of “+” and “/”, so the text can be used in URLs and file names without escaping. It is used by JWT, OAuth and WebAuthn and usually has no “=” padding. The decoder accepts both variants automatically.

What does the “=” at the end mean?

It is padding. Base64 works in blocks of 4 characters; when the input length is not a multiple of 3 bytes, one or two “=” fill the last block. Some systems omit it — this decoder works either way.

How large a file can I encode?

Up to 100 MB per file in modern desktop browsers; many files can be processed at once. On phones, files of a few megabytes work comfortably. Remember that the Base64 text is about 33% larger than the file.

Is Base64 encryption?

No. Base64 is a reversible encoding that anyone can decode. Use it to transport data, not to protect it.

More free, private tools

JSON formatter, image compressor, converters and calculators — all running in your browser.

Browse all tools