HomeDevBase64 Decoder & Encoder
Web tools

Base64 Decoder & Encoder

Encode and decode Base64 text and images. Learn how Base64 encoding works with text, data URIs, and HTML/CSS examples. Runs locally in your browser.

Loading tool…

Loading Preparing tool…

How to use

Follow these steps for a clear answer.

1

Paste or type text

Enter plain text to encode, or Base64 to decode.

2

Choose encode or decode

Run the action you need; work stays in your browser.

3

Copy the result

Click Copy next to Result to copy the converted string.

Base64 encoder / decoder specification

Version 1.0.0 · Last reviewed 2026-07-28

Definition
Base64 encoding converts binary data into ASCII text using 64 printable characters (A–Z, a–z, 0–9, +, /), commonly for data URIs, email MIME, and text-safe binary transport.
What it calculates
UTF-8 text ↔ Base64 (RFC 4648), matching browser btoa/atob with UTF-8-safe encode/decode.
Inputs
  • Plain text (encode) or Base64 string (decode)
  • Mode: encode or decode
Outputs
  • Base64 string (encode) or UTF-8 text (decode)
Formula
encode: UTF-8 bytes → Base64; decode: Base64 → UTF-8 bytes

Base64 encoding converts binary data into ASCII text using 64 printable characters (A–Z, a–z, 0–9, +, /). It is commonly used to embed images in HTML/CSS, encode credentials, and transmit binary data over text-only protocols.

Text to Base64 example

Input text:

The basket is full of grapes.

Encoding process:

  1. Text is converted to ASCII byte values
  2. Bytes are grouped into 6-bit chunks
  3. Each chunk maps to a Base64 character

Output:

VGhlIGJhc2tldCBpcyBmdWxsIG9mIGdyYXBlcy4=

Image to Base64 (data URI)

Images can be embedded directly in HTML or CSS as data URIs:

data:image/jpeg;base64,/9j/4AAQSkZJRg...
Part Meaning
data: Data URI scheme
image/jpeg MIME type
base64, Encoding method
/9j/4AAQ... Encoded image data

HTML img with data URI

<img src="data:image/jpeg;base64,/9j/4AAQSkZJRg..." alt="Photo">

CSS background with data URI

body {
  background-image: url('data:image/jpeg;base64,/9j/4AAQSkZJRg...');
}

When to use Base64

Use case Example
Embed small images inline Icons, tiny graphics
Email attachments MIME encoding
API authentication Basic auth headers
Data transmission JSON with binary payloads

Limitations

  • Base64 increases data size by ~33%
  • Large images as data URIs bloat HTML/CSS files
  • Prefer external image files for large assets
Assumptions
  • Text is treated as UTF-8 (same as encodeURIComponent + btoa in browsers).
  • Conversion runs locally in the browser; nothing is uploaded.
  • Padding with = is allowed and normalized on decode.
Units
  • Input/output: text strings
Boundary conditions
  • Empty input yields an empty result.
  • Invalid Base64 on decode may throw or yield empty output in the UI.
Example
"Hello world" → SGVsbG8gd29ybGQ=
Validation cases
  • "Hello world" encode → SGVsbG8gd29ybGQ=
  • "The basket is full of grapes." encode → VGhlIGJhc2tldCBpcyBmdWxsIG9mIGdyYXBlcy4=
  • SGVsbG8gd29ybGQ= decode → Hello world
  • "café" encode → Y2Fmw6k=
Sources
  • RFC 4648 Base64
  • WHATWG / browser btoa & atob (UTF-8 via encodeURIComponent)
Last reviewed
2026-07-28
Calculation version
1.0.0

Frequently asked questions

Key distinctions behind the tool.

Is Base64 encryption?

No. Base64 is encoding, not encryption. Anyone can decode it.

Should I embed all images as Base64?

No. Use data URIs for small icons only. Large images should be separate files for caching and performance.

How do I decode Base64?

Paste the encoded string into the decoder tool, or use atob() in JavaScript.

What is the = padding at the end?

Base64 output is padded with = characters so the encoded length is a multiple of 4.