ENCODING GUIDE · 6 MIN READ

HOW TO ENCODE AND DECODE BASE64 ONLINE

Encode text and files to Base64, decode Base64 back to original. Free online Base64 converter with no data sent to servers.

By Jobin Blancaflor · March 10, 2026 · 6 min read

TL;DR: Paste your text or upload a file to our free Base64 Encoder/Decoder and instantly encode to Base64 or decode back to original. All processing happens locally in your browser.

What Is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It converts binary data into a text string using 64 characters: A-Z, a-z, 0-9, +, and /.

Base64 encoding was designed to safely transmit binary data over media that only handle text — like email (SMTP), HTML embedding, or URL parameters.

Example:

Original:  Hello World!
Base64:    SGVsbG8gV29ybGQh

How Base64 Works

Base64 encoding works by:

  1. Taking 3 bytes (24 bits) of binary data
  2. Splitting into 4 groups of 6 bits each
  3. Mapping each 6-bit value (0-63) to a Base64 character
  4. Outputting 4 Base64 characters for every 3 input bytes

This means Base64-encoded data is approximately 33% larger than the original binary data.

The Base64 alphabet:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789+/

How to Encode/Decode Base64 (Step by Step)

  1. Open the Base64 Tool — Navigate to armytool.site and select Base64 Encode/Decode from the Encoding Tools category.
  2. Choose operation — Select Encode or Decode mode.
  3. Input data — Paste text for encoding, or paste Base64 string for decoding.
  4. Get result — The conversion happens instantly. Copy the result with one click.

TRY IT NOW — FREE

No data sent to servers. No file size limits. Works offline.

Open Base64 Tool →

Common Use Cases

Email Attachments (MIME)

Email was originally designed for text only. Base64 encoding allows binary attachments (images, documents, executables) to be sent as text. MIME (Multipurpose Internet Mail Extensions) uses Base64 as its standard encoding.

Data URI Schemes

Embed images directly in HTML or CSS without separate HTTP requests:

<img src="data:image/png;base64,iVBORw0KGgoAAAANS...">

Useful for small icons, favicons, and inline graphics.

JSON and XML Payloads

Include binary data in JSON or XML APIs:

{
  "filename": "photo.jpg",
  "content": "/9j/4AAQSkZJRgABAQAA..."
}

Basic Authentication

HTTP Basic Auth encodes credentials as Base64:

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
(Decodes to: username:password)

Note: This is encoding, NOT encryption. Anyone can decode it. Always use HTTPS.

Embedding in URLs

Pass binary data as URL parameters (use URL-safe Base64 variant with - and _ instead of + and /).

Configuration Files

Store binary data (like certificates, keys, or small files) in text-based configuration files.

Base64 Limitations

  • Size overhead — Encoded data is ~33% larger than original
  • Not encryption — Base64 provides no security. Anyone can decode it.
  • Not compression — Base64 doesn't reduce size; it increases it.
  • Character restrictions — Standard Base64 uses + and / which may need URL-encoding.

URL-Safe Base64

Standard Base64 uses + and / which have special meanings in URLs. URL-safe Base64 replaces:

  • +- (hyphen)
  • /_ (underscore)

This allows Base64 strings to be safely used in URLs without additional encoding.

Common Issues and Solutions

Invalid Base64 String

Problem: Decoder reports invalid input

Solutions:

  • Ensure string length is a multiple of 4 (padding with = if needed)
  • Check for invalid characters (only A-Z, a-z, 0-9, +, /, = allowed)
  • Remove any whitespace or line breaks

Garbage Output

Problem: Decoded output looks like gibberish

Solutions:

  • The original data may have been binary (image, file) — save as file, not text
  • Wrong encoding was used — verify the source encoding
  • Data was corrupted during transmission

Padding Issues

Problem: Missing or incorrect = padding

Solution: Base64 strings should be padded to a multiple of 4 characters. Add = characters at the end if needed.

Base64 in Programming

JavaScript

// Encode
const encoded = btoa('Hello World!');
// Decode
const decoded = atob('SGVsbG8gV29ybGQh');

Python

import base64
# Encode
encoded = base64.b64encode(b'Hello World!')
# Decode
decoded = base64.b64decode('SGVsbG8gV29ybGQh')

Node.js

// Encode
const encoded = Buffer.from('Hello World!').toString('base64');
// Decode
const decoded = Buffer.from('SGVsbG8gV29ybGQh', 'base64').toString('utf8');

Java

import java.util.Base64;
// Encode
String encoded = Base64.getEncoder().encodeToString(bytes);
// Decode
byte[] decoded = Base64.getDecoder().decode(string);

Conclusion

Encoding and decoding Base64 doesn't require installing libraries or uploading data to servers. Armytool's Base64 tool handles text and file encoding directly in your browser. Your data never leaves your computer.

Whether you're embedding images in HTML, preparing API payloads, or working with email attachments, the tool is free and ready to use.

ENCODE/DECODE BASE64 NOW

Free, instant, private. Works on any device with a browser.

Open Base64 Tool →