Free Online Tool

Base64 Encoder & Decoder

Encode text, images, and files to Base64 — or decode Base64 back to text, images, and downloadable files — with Data URI & image preview support. 100% private, runs entirely in your browser.

100% Private Image Preview Data URI Support File & Image Encoding URL-Safe Mode
Mode:


            

How It Works

Four simple steps to encode or decode Base64

1

Choose Encode or Decode

Pick "Encode" to convert text or a file to Base64, or "Decode" to convert a Base64 string back to its original form.

2

Enter your data

Type or paste text, drag and drop a file or image to encode, or paste a Base64 string to decode.

3

Choose options

Enable "URL-safe" for Base64URL output, or "Wrap as Data URI" for a ready-to-use data: URI.

4

Copy or download

View the result as text or an image/file preview, then copy it to your clipboard or download it.

Why Use Our Base64 Tool?

Accurate, fast, and privacy-first Base64 conversion without leaving your browser.

100% Private

Your text and files never leave your device. All Base64 encoding and decoding happens locally in your browser.

Image & File Encoding

Drag and drop any image or file to instantly get its Base64 representation and a ready-to-use Data URI.

Smart File Detection

Decoding Base64 automatically detects PNG, JPEG, GIF, WEBP, PDF, ZIP and more, with instant preview and download.

Data URI Support

Wrap output as a complete data: URI for embedding images and files directly into HTML, CSS, or JSON.

URL-Safe Encoding

Toggle RFC 4648 URL-safe Base64 (- and _ instead of + and /) for safe use in URLs, filenames, and tokens.

Clear Error Messages

Invalid Base64 input is detected immediately with a clear explanation — no cryptic browser errors.

Frequently Asked Questions

Common questions about Base64 encoding and decoding

Base64 represents binary data using only 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's commonly used to embed files in JSON, HTML, CSS, or URLs where raw binary data isn't allowed.

Switch to "Encode" mode, select the "File" tab, and drag and drop your image (or click to browse). The tool instantly shows the Base64 string, a ready-to-use Data URI, and an image preview.

Switch to "Decode" mode and paste the Base64 string (with or without the data: URI prefix). If the decoded bytes match a known file signature (PNG, JPEG, GIF, WEBP, PDF, ZIP, etc.), the tool shows a preview and a download button.

Standard Base64 uses "+" and "/", which have special meaning in URLs. URL-safe Base64 (RFC 4648 Section 5) replaces them with "-" and "_" and typically omits padding "=" characters.

A Data URI embeds file data directly inside a URL using the format data:[mime type];base64,[data] — useful for inlining images, fonts, or other files in HTML, CSS, or JSON.

No. All encoding and decoding happens locally in your browser using built-in JavaScript APIs. Your text, files, and images never leave your device.

Decoding fails if the input contains characters outside the Base64 alphabet or has an invalid length. The tool reports a clear error message describing the problem.