What is Base64 Encoding?
Free Online Base64 Encoder / Decoder
Encode or decode Base64 strings instantly. Supports text and files. Runs entirely in your browser.
Open Base64 Encoder / Decoder →What is Base64?
Base64 is an encoding scheme that converts binary data into a string of ASCII characters. It uses a set of 64 characters — A-Z, a-z, 0-9, +, and / — to represent any sequence of bytes.
The name "Base64" refers to the 64 characters used in the encoding. Each Base64 character represents 6 bits of data, so 3 bytes (24 bits) of input become 4 Base64 characters (24 bits).
Original text: Hello, World! Base64 encoded: SGVsbG8sIFdvcmxkIQ==
Why is Base64 used?
Binary data can contain bytes that have special meaning in certain contexts — for example, null bytes or line breaks that would break an email protocol or a URL. Base64 solves this by converting any binary data into safe, printable ASCII characters that can be transmitted through any text-based system.
Common use cases:
- JWTs — the header and payload are Base64URL-encoded
- Data URLs — embedding images directly in HTML/CSS (
data:image/png;base64,...) - HTTP Basic Auth — credentials are sent as
username:passwordBase64-encoded - Email attachments — MIME encoding for binary file attachments
- API keys and tokens — many tokens are Base64-encoded for safe transmission
- Cryptographic signatures — public keys and certificates use Base64 (PEM format)
Base64 vs Base64URL
Standard Base64 uses + and / characters, which have special meaning in URLs. Base64URL is a URL-safe variant that replaces + with - and / with _. JWTs use Base64URL encoding.
| Variant | Characters used | Padding | Use case |
|---|---|---|---|
| Base64 | A-Z, a-z, 0-9, +, / | = padding | General encoding, email |
| Base64URL | A-Z, a-z, 0-9, -, _ | No padding | JWTs, URLs, filenames |
How to encode and decode Base64 online
- Open the Base64 encoder/decoder on tinybench.dev
- Choose Encode or Decode mode
- Paste your text or upload a file
- Copy the result — all in your browser, nothing sent to a server
Base64 in code
// Encode
const encoded = btoa('Hello, World!'); // "SGVsbG8sIFdvcmxkIQ=="
// Decode
const decoded = atob('SGVsbG8sIFdvcmxkIQ=='); // "Hello, World!"import base64
# Encode
encoded = base64.b64encode(b'Hello, World!').decode('utf-8')
# Decode
decoded = base64.b64decode('SGVsbG8sIFdvcmxkIQ==').decode('utf-8')// Encode
const encoded = Buffer.from('Hello, World!').toString('base64');
// Decode
const decoded = Buffer.from('SGVsbG8sIFdvcmxkIQ==', 'base64').toString('utf-8');Frequently asked questions
Try it now — free & private
Runs entirely in your browser. No sign-up, no uploads, no tracking.
Open Base64 Encoder / Decoder →