Processed entirely in your browser. Your input is not uploaded.

Base64 Encoder / Decoder

Encode text or upload files to Base64 (raw, Data URL, img tag, CSS url), or decode Base64 strings with live image previews and file downloads.

Last updated November 12, 2026

Loading tool workspace…

Overview

Encodes text strings or local files into Base64 (standard or RFC 4648 URL-safe) and decodes Base64 payloads back to UTF-8 text or binary files. Includes instant output formatting (Data URL, HTML <img> tag, CSS url()), live image previews for decoded graphic payloads, and one-click JSON formatting.

How it works

Base64 maps binary data onto 64 printable ASCII characters, transforming each 3-byte chunk into 4 6-bit characters. The encoder uses modern TextEncoder bytes to preserve multi-byte UTF-8 emojis and non-Latin scripts. In URL-safe mode, '+' becomes '-' and '/' becomes '_' while trailing '=' padding is stripped. The decoder automatically restores missing padding, translates URL-safe alphabets, and detects image magic numbers (PNG, JPEG, GIF, WEBP) to render live canvas previews.

How to use the Base64 Encoder / Decoder

1

Select Mode

Choose Encode or Decode tab.

2

Input Text or Upload File

Type/paste text or upload a local file directly from your computer.

3

Format & Export

Choose Raw string, Data URL, HTML <img>, or CSS url(), preview decoded images, and copy or download.

When to use it

  • Embedding small icons, SVGs, and favicons directly into HTML or CSS without extra HTTP requests.
  • Inspecting and decoding Base64 tokens, Basic Authentication headers, or API responses.
  • Converting local binary images into shareable Data URLs without uploading to an external host.

Examples

Text to Base64

Input
Hello, world!
Output
SGVsbG8sIHdvcmxkIQ==

The two '=' characters represent padding to complete the 4-character block.

Image Data URL

Input
1x1 transparent PNG
Output
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=

Directly consumable in CSS background-image: url(...) or HTML <img src='...'>.

Key Features & Accuracy

Direct File Encoding

Upload images, SVGs, or files to immediately produce Base64 strings or ready-to-use Data URLs.

Image Preview & File Download

Automatically renders decoded PNG, JPEG, GIF, and WEBP payloads with instant file download.

URL-Safe Base64

RFC 4648 §5 compliance replacing + and / with - and _ for safe query param and JWT payload transmission.

Limitations & important notes

Base64 is an encoding format, NOT encryption — it provides zero secrecy and is trivially decoded by anyone.
Base64 encoding increases data payload size by approximately 33% compared to raw binary.
Large file uploads (>10 MB) may cause browser memory pressure since all processing occurs entirely in client memory.

Frequently Asked Questions

It maps 3 binary bytes (24 bits) into 4 ASCII characters (32 bits), increasing total data volume by roughly 33.3%.