Base64 converter

Encode/decode text, files & images

Overview

The Base64 Converter transforms data between its original format and Base64 encoding. With 4 specialized modes for text and images, you can encode plain text to Base64, decode Base64 back to text, convert images to Base64 data URIs, or restore images from Base64 strings.

Text encode
Convert plain text to Base64 encoded string
Text decode
Convert Base64 string back to readable text
Image encode
Convert images to Base64 data URIs for HTML/CSS
Image decode
Convert Base64 strings back to downloadable images

Interface overview

The Base64 Converter has a clean two-panel layout with the conversion mode selector at the top. Here's what you'll find:

1

Conversion mode selector (top)

At the top, you'll see 4 mode buttons arranged horizontally:
Text encode: Text to Base64
Text decode: Base64 to Text
Image encode: Image to Base64
Image decode: Base64 to Image

Click any button to switch modes. The active mode is visually highlighted. You can collapse this section using the arrow icon on the right.

2

Input panel (left)

The left panel is for your input data. The header changes based on mode:
Text encode: Input text
Text decode: Base64 input
Image encode: Input image
Image decode: Base64 input

Action buttons appear in the top right of the panel (Upload, Paste, Trim, Clear). Below is the input area - either a text field or a drop zone.

3

CONVERT button & Swap icon

In the center between the two panels:
CONVERT button (orange) - click to convert your input to output
Swap icon (arrows) - swaps the input and output content (useful for re-encoding)

Note: With Auto-convert enabled, conversion happens automatically as you type.

4

Output panel (right)

The right panel shows your conversion result. The header changes based on mode:
Text encode: Base64 output
Text decode: Decoded text
Image encode: Base64 output
Image decode: Decoded image

Action buttons - Copy, Download. The result displays as text or an image preview.

5

Bottom bar

At the bottom of the tool:
Auto-convert checkbox (left) - enables automatic conversion as you type
Image prefix checkbox (Image encode only) - adds data URI prefix
Statistics (right) - shows conversion metrics (different for text vs image modes)

6

Favorites (top right)

The heart icon in the top right lets you add this tool to your favorites for quick access from the homepage.

Base64 Converter interface showing conversion modes, input/output panels, and statistics
Base64 Converter interface overview

Conversion modes

The Base64 Converter offers 4 specialized modes. Each mode is optimized for a specific type of conversion, with appropriate input methods and output formats.

Text encode mode Text to Base64

Text encode mode converts plain text (letters, numbers, symbols) into a Base64 encoded string. This is the default mode and most commonly used for basic encoding.

1

Select Text encode mode

Click the Text encode button at the top. It shows Text to Base64 as the description. This is the default mode when you open the tool.

2

Enter your text

You have multiple options to input text:
Type directly: start typing in the input area
Paste: click the Paste button or use Ctrl+V (⌘+C on Mac)
Upload file: drop a TXT, JSON, or XML file

The drop zone shows Drop files here or start typing with supported format badges - TXT, JSON, XML.

3

Get Base64 output

With Auto-convert enabled, the Base64 result appears instantly as you type in the Base64 output panel. Without Auto-convert, click the orange CONVERT button.

4

Use the result

Click Copy to copy the Base64 string to clipboard, or Download to save it as a file. Use this Base64 string in APIs, configurations, or anywhere text-safe encoding is needed.

Text encode mode showing input text and Base64 output
Text encode mode
Common uses
Encode credentials for HTTP Basic Auth, encode data for JSON APIs, encode configuration values, or prepare text for systems that don't support special characters.

Text decode mode Base64 to Text

Text decode mode converts a Base64 encoded string back into readable plain text. Use this to decode Base64 strings you've received or found.

1

Select Text decode mode

Click the Text decode button at the top. It shows Base64 to Text as the description.

2

Enter Base64 string

Input your Base64 encoded string:
Type/paste directly: enter the Base64 string in the input area
Upload file: drop a TXT, JSON, or XML file containing Base64

The input area is labeled Base64 input.

3

Trim whitespace (optional)

Use the Trim button (scissors icon) to remove leading/trailing whitespace from your Base64 input. This is helpful when copying Base64 from sources that add extra spaces.

4

Get decoded text

The decoded text appears in the output panel. If the Base64 encoded binary data (not text), the output may show unreadable characters - this is normal for non-text data.

5

Use the result

Click Copy to copy the decoded text to clipboard, or Download to save it as a file. The decoded text is ready to use in your application or document.

Text decode mode showing Base64 input and decoded text output
Text decode mode
Invalid Base64
If decoding fails or shows garbage, the input may not be valid Base64, or it may be Base64-encoded binary (not text). Binary data won't display as readable text.

Image encode mode Image to Base64

Image encode mode converts image files into Base64 data URIs that can be embedded directly in HTML, CSS, or JSON - no external file needed.

1

Select Image encode mode

Click the Image encode button at the top. It shows Image to Base64 as the description.

2

Upload an image

The drop zone shows Drop images here or click upload with supported formats:

Row 1: JPG, PNG, GIF, BMP, ICO
Row 2: WEBP, AVIF, TIFF, HEIC, HEIF

Drag and drop an image or click to browse. The image preview appears in the input area.

Note: HEIC/HEIF files are automatically converted to JPEG and TIFF files to PNG for browser compatibility. The statistics panel shows the original format, while the Base64 output contains the converted format.

3

Configure options

Two checkboxes are available at the bottom:
Auto-convert: automatically convert when image is uploaded
Image prefix: include the data URI prefix (e.g., "data:image/png;base64,")

Keep Image prefix checked for HTML/CSS use.

4

Get Base64 data URI

The output is a complete data URI ready for use:

data:image/png;base64,iVBORw0KGgoAAAA...

Copy this entire string and paste it into HTML src attributes or CSS url() values.

5

View image statistics

The statistics bar shows detailed image information:
RESOLUTION: image dimensions (e.g., 800x600)
MIME TYPE: format (e.g., image/png)
SIZE: file size
CHANNELS: color channels (RGB, RGBA)
BIT DEPTH: color depth
EXTENSION: file extension

6

Use the result

Click Copy to copy the Base64 data URI to clipboard, or Download to save it as a text file. Paste the data URI directly into HTML <img src="..."> or CSS background-image: url(...) for inline embedding.

Image encode mode showing uploaded image and Base64 data URI output
Image encode mode
Best practice
Data URIs work best for small images (icons, logos, small graphics). For images larger than 10-20 KB, regular file references are more efficient and cacheable.

Image decode mode Base64 to Image

Image decode mode converts a Base64 encoded image string back into a viewable and downloadable image file.

1

Select Image decode mode

Click the Image decode button at the top. It shows Base64 to Image as the description.

2

Enter Base64 image string

Input the Base64 encoded image data:
Paste directly: paste the Base64 string (with or without data URI prefix)
Upload file: drop a TXT file containing the Base64 string

The tool automatically detects the image format from the data.

3

Trim whitespace (optional)

Use the Trim button (scissors icon) to remove leading/trailing whitespace from your Base64 input. This is helpful when copying Base64 from sources that add extra spaces or line breaks.

4

View image statistics

The statistics bar shows detailed image information:
RESOLUTION: image dimensions (e.g., 800x600)
MIME TYPE: format (e.g., image/png)
SIZE: file size
CHANNELS: number of color channels (3 = RGB, 4 = RGBA)
BIT DEPTH: color depth
EXTENSION: file extension

This helps verify the image was decoded correctly.

5

Use the result

The Decoded image panel shows a preview of the restored image. Click Copy to copy the image to clipboard, or Download to save the image as a file. The tool automatically detects the image format from the Base64 data (JPEG, PNG, GIF, WebP, BMP, AVIF, TIFF, SVG) and saves with the correct extension.

Image decode mode showing Base64 input and decoded image preview
Image decode mode
Data URI prefix
The tool accepts Base64 with or without the data URI prefix. Both formats work:
data:image/png;base64,iVBORw0KGgo... (with prefix)
iVBORw0KGgo... (without prefix)

Input panel actions

The input panel header contains action buttons that help you manage your input data. Available buttons vary slightly by mode.

1

Upload button

Click the Upload button (upload icon) to open a file browser and select a file to import. Alternatively, drag and drop files directly onto the input area.

2

Paste button

Click the Paste button (clipboard icon) to paste content from your clipboard. This is equivalent to pressing Ctrl+V (⌘+V on Mac) but works even when the input area isn't focused.

3

Trim button (Text modes only)

Click the Trim button (scissors icon) to remove whitespace from the beginning and end of your input. Useful when Base64 strings have been copied with extra spaces or line breaks.

4

Clear button

Click the Clear button (red trash icon) to remove all content from the input area. This also clears the output and resets statistics.

Input panel action buttons - Upload, Paste, Trim, Clear
Input panel actions

Output panel actions

The output panel header contains action buttons for working with your conversion results.

1

Copy button

Click the Copy button (clipboard icon) to copy the entire output to your clipboard. A notification confirms the copy. For text modes, this copies the text. For image decode, this copies the image data.

2

Download button

Click the Download button (download icon) to save the output as a file:
Text encode: Downloads as .txt with Base64 content
Text decode: Downloads as .txt with decoded text
Image encode: Downloads as .txt with Base64 data URI
Image decode: Downloads the actual image file (PNG, JPG, etc.)

Output panel action buttons - Copy, Download
Output panel actions

Auto-convert feature

The Auto-convert checkbox at the bottom left enables real-time conversion as you type or upload content.

1

When enabled (default)

With Auto-convert checked (default setting):
Conversion happens instantly as you type
Results update in real-time
No need to click CONVERT button
Statistics update live

This provides immediate feedback and the fastest workflow.

2

When disabled

With Auto-convert unchecked:
You must click the CONVERT button to convert
Useful for very large inputs where real-time conversion would be slow
Gives you control over when conversion happens
Reduces CPU usage during input

3

Image prefix checkbox (Image encode only)

In Image encode mode, an additional checkbox appears:
Image prefix: when checked, output includes the full data URI prefix: data:image/png;base64,
When unchecked, output is just the raw Base64 string without prefix

Keep this checked for HTML/CSS embedding. Uncheck it if you only need the raw Base64.

Auto-convert and Image prefix checkboxes
Auto-convert feature

Statistics (Text modes)

When using Text encode or Text decode modes, the statistics bar at the bottom right shows three metrics:

1

INPUT counter

Shows the character count of your input data. For Text encode, this is the number of characters in your plain text. For Text decode, this is the length of your Base64 string.

2

OUTPUT counter

Shows the character count of the conversion result. For Text encode, this is the Base64 string length. For Text decode, this is the decoded text length.

3

RATIO badge (orange)

Shows the size ratio between output and input (e.g., "1.33x"). For encoding, this is typically ~1.33x (33% larger). For decoding, this is typically ~0.75x (25% smaller). The ratio helps you understand the Base64 size overhead.

Statistics bar showing INPUT, OUTPUT, and RATIO counters
Statistics (Text modes)

Statistics (Image modes)

When using Image encode or Image decode modes, the statistics bar shows detailed image metadata:

1

RESOLUTION

Shows the image dimensions in pixels (e.g., "1920x1080"). This confirms the image was loaded/decoded correctly.

2

MIME TYPE

Shows the image format type (e.g., "image/png", "image/jpeg"). This is the format that will be used in the data URI prefix.

3

SIZE

Shows the file size of the original image (e.g., "45.2 KB").

Note: Base64 output will be ~33% larger than this.

4

CHANNELS

Shows the number of color channels as a digit:
3: RGB (red, green, blue - no transparency)
4: RGBA (red, green, blue, alpha - with transparency)
1: Grayscale (single channel)

5

BIT DEPTH

Shows the color bit depth (e.g., "8-bit", "16-bit"). Higher bit depth means more color precision but larger file size.

6

EXTENSION badge (orange)

Shows the file extension (e.g., "PNG", "JPG"). This is highlighted in orange as the primary format identifier.

Statistics bar showing RESOLUTION, MIME TYPE, SIZE, CHANNELS, BIT DEPTH, and EXTENSION
Statistics (Image modes)

What is Base64?

Base64 is an encoding method that converts binary data into a text format using 64 printable ASCII characters. Understanding Base64 helps you use this tool effectively.

1

Binary to text conversion

Computers store data as binary (0s and 1s), but many systems only handle text. Base64 converts binary files into text that can pass through text-only channels like email, JSON APIs, or HTML attributes.

2

The 64 characters

Base64 uses exactly 64 characters:
A-Z (26 uppercase letters)
a-z (26 lowercase letters)
0-9 (10 digits)
+ and / (2 special characters)
= (padding character)

These characters are safe in almost any text context.

3

Size increase (~33%)

Base64-encoded data is approximately 1.33x larger than the original. Every 3 bytes of binary become 4 characters of Base64. This is the trade-off for text compatibility.

Example: A 100 KB image becomes ~133 KB of Base64 text.

4

NOT encryption

Important: Base64 is encoding, NOT encryption. Anyone can decode it instantly - it provides zero security. Never use Base64 to "hide" passwords or sensitive data. Use proper encryption for security.

Quick example
Text "Hello" → Base64 "SGVsbG8="
Base64 "SGVsbG8=" → Text "Hello"

The process is fully reversible - encoding then decoding gives back the exact original.

Base64 character reference Reference table

Base64 uses exactly 64 characters to represent binary data. Below the main tool, you'll find a reference table showing all 64 characters with their index values and binary equivalents.

1

The 64 characters

The standard Base64 alphabet consists of:
Index 0-25: A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
Index 26-51: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
Index 52-61: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Index 62: + (plus)
Index 63: / (slash)

2

The padding character

The = (equals sign) is used for padding. Base64 works in groups of 4 characters representing 3 bytes. When the input doesn't divide evenly by 3:
1 byte remaining → output ends with "=="
2 bytes remaining → output ends with "="
3 bytes (no remainder) → no padding needed

3

Binary representation

The reference table shows the 6-bit binary value for each character:
A = 000000 (decimal 0)
B = 000001 (decimal 1)
/ = 111111 (decimal 63)

Each Base64 character represents exactly 6 bits of data.

4

Why these characters?

These 64 characters were chosen because they:
Are printable ASCII characters
Are safe in most text contexts (URLs, email, HTML)
Don't conflict with common delimiters
Are available on all keyboards

Base64 character reference table showing all 64 characters with index and binary values
Base64 character reference table
URL-safe Base64
Some systems use URL-safe Base64 which replaces + with - and / with _ to avoid URL encoding issues. Our tool uses standard Base64.

Common use cases

Embedding images in HTML/CSS
Convert small images to Base64 data URIs and embed directly in HTML img tags or CSS background-image. Eliminates extra HTTP requests for small assets.
Email attachments
Email protocols are text-based. All attachments are Base64-encoded so binary files can travel through email servers without corruption.
JSON API data transfer
JSON can't include raw binary data. Base64 encoding lets you send files, images, and binary content through JSON APIs.
HTTP Basic Authentication
Basic Auth sends "username:password" as Base64 in the Authorization header. Decode auth headers to see credentials (always use HTTPS!).
JWT token inspection
JSON Web Tokens (JWTs) are Base64-encoded. Decode them to inspect the header and payload sections (signature requires verification).
Storing binary in text fields
Some databases or configuration files only support text. Base64 lets you store binary data as text (though BLOB types are usually better).

Tips & Best practices

Keep images small
Base64 data URIs work best for images under 10-20 KB (icons, logos). Larger images are better served as separate files for caching benefits.
Use Trim for clean input
When decoding Base64 copied from other sources, use the Trim button to remove whitespace that can cause decoding errors.
Check the RATIO
The RATIO statistic shows Base64 overhead. If encoding, expect ~1.33x. If decoding, expect ~0.75x. Different ratios indicate issues.
Verify decoded images
After decoding an image, check the statistics (resolution, format) to verify it decoded correctly before downloading.
Keep Image prefix for HTML
When encoding images for HTML/CSS use, keep the Image prefix checkbox enabled to get the complete data URI ready for embedding.
Don't use for security
Base64 is NOT encryption. Never use it to "hide" sensitive data. Anyone can decode it instantly. Use proper encryption for security.

Frequently asked questions

Text encode converts plain text to Base64. Text decode converts Base64 back to text. Image encode converts image files to Base64 data URIs. Image decode converts Base64 back to downloadable images.
No! Base64 is encoding, NOT encryption. Anyone can decode it instantly with any Base64 tool. Never use Base64 to "hide" passwords or sensitive data. Use proper encryption (AES, RSA) for security.
Base64 encoding increases data size by approximately 33%. This is normal and unavoidable - 3 bytes of input become 4 characters of output. The RATIO statistic shows this overhead.
You may be trying to decode: (1) invalid Base64 string, (2) Base64-encoded binary data (images, files) which won't display as readable text, or (3) text with wrong encoding. Try Image decode if it might be an image.
The '=' is padding. Base64 works in groups of 4 characters. If the input doesn't divide evenly, '=' or '==' is added to complete the final group. It's part of valid Base64.
Image encode supports: JPG, PNG, GIF, BMP, ICO, WEBP, AVIF, TIFF, HEIC, HEIF. HEIC/HEIF files are automatically converted to JPEG and TIFF files to PNG for browser compatibility - the original format is shown in the statistics panel. Image decode automatically detects the format from the Base64 data using signature detection and downloads with the correct file extension.
Yes, but performance may suffer with very large files (several MB). Everything runs in your browser, so available memory matters. The Auto-convert feature can be disabled for large inputs.
A data URI is a way to embed file content directly in HTML/CSS. Format: data:[mime-type];base64,[data]. Example: data:image/png;base64,iVBORw0KGgo... can be used directly in an img src attribute.
Uncheck "Image prefix" when you need only the raw Base64 string without the data URI prefix - for example, when storing Base64 in a database or sending through an API that adds its own prefix.
No. All conversion happens locally in your browser using JavaScript. Your data never leaves your device. This tool is completely client-side for maximum privacy.

Ready to convert?

Encode or decode Base64 for text and images instantly.

Open Base64 Converter

Documentation