Back to Tools & Utilities

Developer Tools

Base64 Encoder & Decoder Online

Encode plain text into Base64 format or decode Base64 strings back into readable text instantly. Perfect for API testing, authentication headers, JSON payloads, JWT debugging, and developer workflows. Everything runs securely inside your browser.

UTF-8 Support
Instant Conversion
Copy Output
Client-Side Only
Developer Friendly
Mobile Compatible

Base64 Encoding Example

Original Text

NVR Nexus

Base64 Encoded

TlZSIE5leHVz
Plain Text Input
Base64 Output
// Output appears here…

🔒 100% Client-Side Processing

All encoding and decoding operations occur directly within your browser using native JavaScript APIs (btoa() and atob()). No text is transmitted to external servers, logged, or stored. This makes the tool suitable for working with API keys, authentication headers, configuration values, and other sensitive development data.


Common Base64 Use Cases

🔑

Basic Auth Headers

Encode username:password credentials for HTTP Basic Authentication headers used in REST APIs.

🧪

API Testing

Encode and decode request/response payloads when testing API endpoints with tools like Postman or cURL.

📦

JSON Payload Transport

Encode JSON data for embedding inside URLs, HTML attributes, or systems that restrict special characters.

📧

Email MIME Encoding

Email systems use Base64 to encode attachments and non-ASCII characters in message bodies (RFC 2045).

🪙

JWT Token Inspection

Decode the header and payload segments of JSON Web Tokens to inspect claims and metadata.

🖼

Data URI Generation

Convert images or fonts to Base64 for embedding directly into HTML/CSS as data:// URIs.

⚙️

Config File Storage

Store binary configuration data, certificates, or keys as Base64 strings in YAML/JSON config files.

🔄

Binary-to-Text Conversion

Convert any binary data to a printable ASCII string safe for transmission over text-only protocols.


How Base64 Encoding Works

Base64 converts binary data into a set of 64 printable ASCII characters. The name comes from the number of characters in the encoding alphabet: 26 uppercase letters (A–Z), 26 lowercase letters (a–z), 10 digits (0–9), and two symbols (+ and /), totaling 64. A 65th character, the equals sign (=), is used as padding.

Every 3 bytes (24 bits) of input data are transformed into 4 encoded characters (each representing 6 bits). This is because 2⁶ = 64 — six bits can represent exactly 64 different values, corresponding to the 64-character alphabet. This 3-to-4 byte ratio is why Base64 encoding increases data size by approximately 33%.

Step-by-step: encoding "Man"

Input: M (77), a (97), n (110)

Binary: 01001101 01100001 01101110

Groups: 010011 | 010110 | 000101 | 101110

Decimal: 19 | 22 | 5 | 46

Output: T | W | F | u → TWFu

This process allows data to travel safely through email systems, HTTP requests, APIs, and other text-based protocols without corruption. Systems that were designed for 7-bit ASCII can safely transmit Base64-encoded data that originally contained arbitrary binary values including null bytes and control characters.

Base64 in HTTP Basic Authentication

One of the most common developer encounters with Base64 is in HTTP Basic Authentication. When a server requires Basic Auth, the client encodes the credentials as username:password in Base64 and sends the result in the Authorization header:

// Credentials

admin:password123

// Base64 encoded

YWRtaW46cGFzc3dvcmQxMjM=

// HTTP Header

Authorization: Basic YWRtaW46cGFzc3dvcmQxMjM=

Security warning: Basic Auth credentials are only Base64-encoded, not encrypted. Always use HTTPS when transmitting Basic Auth headers to prevent credentials from being intercepted in plaintext.

Base64 URL Encoding vs Standard Base64

Standard Base64 uses + and / as the 62nd and 63rd characters. These characters have special meaning in URLs — + is a space and / is a path separator. This makes standard Base64 unsafe for use in URLs and filenames.

Variant62nd char63rd charPaddingUsed In
Standard Base64+/= (required)Email (MIME), HTTP headers, general data encoding
Base64URL-_= (optional, often omitted)JWTs, OAuth tokens, URL parameters, filenames
Base64 MIME+/=, with line breaks at 76 charsEmail attachments (RFC 2045)

Base64 Encoding Across Programming Languages

Base64 encoding is natively supported in virtually every programming language. Here are the most common implementations:

JavaScript (Browser)
// Encode
btoa("Hello World")  // → "SGVsbG8gV29ybGQ="

// Decode
atob("SGVsbG8gV29ybGQ=")  // → "Hello World"
Python 3
// Encode
import base64
base64.b64encode(b"Hello World")  # → b"SGVsbG8gV29ybGQ="

// Decode
base64.b64decode("SGVsbG8gV29ybGQ=")  # → b"Hello World"
Node.js
// Encode
Buffer.from("Hello World").toString("base64")  // → "SGVsbG8gV29ybGQ="

// Decode
Buffer.from("SGVsbG8gV29ybGQ=", "base64").toString()  // → "Hello World"

Base64 Best Practices for Developers

Always use HTTPS when transmitting Base64-encoded credentials in Authorization headers — Base64 is encoding, not encryption.
For URLs and JWT tokens, use Base64URL encoding (replace + with -, / with _, and omit padding =) to avoid URL-encoding issues.
When encoding non-ASCII or Unicode text, always encode the UTF-8 byte representation of the text, not the raw character codes.
Don't use Base64 to 'hide' sensitive data in client-side code — it is trivially decodable by anyone who inspects your source.
For large binary files, consider chunked Base64 encoding to avoid memory issues. A 10 MB file becomes ~13.3 MB in Base64.
When decoding user-supplied Base64, always wrap in try/catch to handle invalid input gracefully without crashing.
Base64 encoded data URI format for images: data:image/png;base64,<encoded-data> — useful for small icons in CSS and HTML.

Frequently Asked Questions