Base64 Encode & Decode Online — Free Base64 Converter

Encode text to Base64 or decode Base64 back to plain text instantly in your browser. Free, private, no signup required. Supports full UTF-8 character set.

Plain Text Input0 chars
Base64 Encoded Output

Instant Encoding

Convert any text to Base64 in real-time as you type. Results appear instantly with zero network latency.

Full UTF-8 Support

Properly handles all Unicode characters including emoji, CJK characters, accented letters, and special symbols.

Privacy First

All processing happens locally in your browser. Your data is never sent to any server or stored anywhere.

What Is Base64 Encoding? A Complete Guide

Base64 is one of the most widely used encoding schemes in software development. It converts binary data into a string of printable ASCII characters, making it safe to transmit through text-based protocols that may not handle raw binary data correctly.

The name "Base64" comes from the 64-character alphabet used in the encoding: the uppercase letters A-Z (26), lowercase letters a-z (26), digits 0-9 (10), and two additional characters + and / (2). The = character is used for padding when the input length is not a multiple of 3.

How Base64 Encoding Works

The Base64 encoding process works in three steps:

  1. Split input into 3-byte groups. Each group of 3 bytes (24 bits) is taken from the input data.
  2. Divide into 4 groups of 6 bits. The 24 bits are split into four 6-bit values (each ranging from 0 to 63).
  3. Map to the Base64 alphabet. Each 6-bit value is converted to its corresponding character in the Base64 alphabet (A=0, B=1, ..., Z=25, a=26, ..., z=51, 0=52, ..., 9=61, +=62, /=63).

If the input length is not a multiple of 3 bytes, padding characters (=) are added to make the output length a multiple of 4.

The Base64 Character Table

0-9: A B C D E F G H I J
10-19: K L M N O P Q R S T
20-25: U V W X Y Z
26-35: a b c d e f g h i j
36-45: k l m n o p q r s t
46-51: u v w x y z
52-61: 0 1 2 3 4 5 6 7 8 9
62-63: + / pad: =

Encoding Example

Let's encode the string "Hi" step by step:

Text: H i

ASCII: 72 105

Binary: 01001000 01101001

6-bit groups: 010010 000110 100100 (padded with zeros)

Base64 values: 18 6 36

Base64 chars: S G k =

Result: SGk=

Common Use Cases for Base64

  • Data URIs in HTML/CSS — Embed images, fonts, and other assets directly in HTML or CSS using data:image/png;base64,... syntax. This eliminates extra HTTP requests.
  • HTTP Basic Authentication — The Authorization header uses Base64 to encode username:password as Basic dXNlcm5hbWU6cGFzc3dvcmQ=.
  • Email Attachments (MIME) — Binary files attached to emails are Base64 encoded for safe transmission through SMTP, which is a text-based protocol.
  • JSON Web Tokens (JWT) — JWTs encode their header and payload sections using Base64URL encoding (a URL-safe variant).
  • Embedding binary in JSON/XML — Since JSON and XML are text formats, binary data (like images or certificates) must be Base64 encoded before embedding.
  • API Payloads — Some APIs accept file uploads as Base64 encoded strings in the request body, avoiding multipart form data.

Base64 in Different Programming Languages

JavaScript / Node.js

// Browser
btoa("Hello World")        // Encode: "SGVsbG8gV29ybGQ="
atob("SGVsbG8gV29ybGQ=")  // Decode: "Hello World"

// Node.js
Buffer.from("Hello World").toString("base64")
Buffer.from("SGVsbG8gV29ybGQ=", "base64").toString()

Python

import base64
base64.b64encode(b"Hello World")  # b'SGVsbG8gV29ybGQ='
base64.b64decode(b"SGVsbG8gV29ybGQ=")  # b'Hello World'

Java

import java.util.Base64;
Base64.getEncoder().encodeToString("Hello World".getBytes());
new String(Base64.getDecoder().decode("SGVsbG8gV29ybGQ="));

Go

import "encoding/base64"
encoded := base64.StdEncoding.EncodeToString([]byte("Hello World"))
decoded, _ := base64.StdEncoding.DecodeString("SGVsbG8gV29ybGQ=")

Base64 vs Base64URL

FeatureStandard Base64Base64URL
Character 62+-
Character 63/_
PaddingRequired (=)Optional
URL SafeNoYes
Used InEmail, data URIsJWTs, URLs, filenames

Important: Base64 Is Not Encryption

A common misconception is that Base64 provides security. It does not. Base64 is a reversible encoding — anyone can decode a Base64 string without any secret key. Never use Base64 to "protect" passwords, API keys, or sensitive data. For actual security, use:

  • Encryption — AES-256, RSA, or ChaCha20 for data confidentiality
  • Hashing — SHA-256 or bcrypt for password storage
  • TLS/HTTPS — For secure data transmission

How to Encode and Decode Base64 Online

  1. 1. Select Encode to Base64 to convert plain text, or Decode from Base64 to convert back.
  2. 2. Paste or type your text — results update in real-time as you type.
  3. 3. Use Swap Input/Output to flip the result for chained encode/decode operations.
  4. 4. Click Copy to copy the output to your clipboard.

Frequently Asked Questions

How do I encode text to Base64 online?

Select the Encode tab, paste or type your text, and the Base64 encoded result appears instantly. Click Copy to copy it to your clipboard. No signup or server upload required — everything runs in your browser.

How do I decode Base64 back to text?

Select the Decode tab, paste your Base64 string, and the decoded plain text appears instantly. The tool handles standard Base64 and properly decodes UTF-8 encoded content including non-ASCII characters.

What is Base64 encoding used for?

Base64 is used to safely transmit binary data through text-based channels like HTTP headers, HTML data URIs, JSON fields, email MIME attachments, and API payloads. It converts arbitrary bytes into printable ASCII characters.

Why does Base64 increase data size by 33%?

Base64 encodes every 3 bytes of input into 4 ASCII characters. Since each output character is 1 byte, the encoded data is 4/3 (approximately 133%) of the original size. This overhead is the trade-off for text-safe representation of binary data.

What is the difference between Base64 and Base64URL?

Standard Base64 uses + and / characters which have special meaning in URLs. Base64URL replaces + with - and / with _, and makes padding optional. This makes it safe for URL parameters, filenames, and JWTs.

Is Base64 encryption?

No. Base64 is a reversible encoding scheme, not encryption. Anyone can decode Base64 without any secret key. Never use Base64 to protect sensitive data — use proper encryption algorithms like AES-256 or RSA instead.

Can I encode images to Base64?

Yes. Images can be Base64 encoded for use as data URIs in CSS/HTML (data:image/png;base64,...). FastDevKit offers a dedicated Image to Base64 converter tool for this purpose. This tool is optimized for text encoding/decoding.

Is my data safe when using this tool?

Yes. All encoding and decoding runs entirely in your browser using JavaScript. Your text is never uploaded to any server, stored in any database, or logged in any way. This makes it safe for encoding sensitive data.

Related Base64 & Encoding Tools