Base64 Encoder & Decoder Online — Free Encode & Decode Tool

Base64 Encode/Decode

Encode and decode Base64 strings, files, and data URIs instantly.

Free online Base64 encoder, decoder, and binary data converter. Easily encode raw text or upload binary files to standard Base64 (RFC 4648 §4) and URL-safe Base64 (RFC 4648 §5) for JWTs and web URLs. Decode Base64 strings back to clean UTF-8 text, ASCII, or downloadable binary files. Convert between Base64 and hexadecimal, wrap output lines at 76 characters for RFC 2045 MIME compliance, and generate ready-to-use HTML/CSS Data URIs for images, fonts, and assets. Processes everything 100% client-side in your browser with zero server transmission for absolute privacy.

Keywords: base64 encoder, base64 decoder, base64 encode online, base64 decode online, base64 to text, text to base64, base64 file, data uri generator, base64 image, url safe base64, base64 to hex, base64 converter, base64 online, encode base64, decode base64, rfc 4648 encoder, base64url decoder, binary to base64

Tags: base64, encode, decode, binary, data-uri, url-safe, rfc4648

Browse all 12 Text & Data tools →

Base64 Encode/Decode is also known as: Base64 Encoder, Base64 Decoder Online, Base64 to Text Converter, Text to Base64, URL Safe Base64 Converter, Base64 to Image Data URI, Base64 to Hex Converter, Base64 Binary File Converter.

How to Base64 Encode/Decode Online

  1. Paste raw text, code snippets, or hexadecimal strings into the input editor, or drag and drop any binary file (image, font, document) directly into the upload area.

  2. Choose your target operation: "Encode" to convert raw data to Base64, "Decode" to restore original text or binary files, "Data URI" to create inline embed strings, or "To Hex" / "From Hex" for byte inspection.

  3. Configure encoding options: enable "URL-Safe" (RFC 4648 §5) to produce query-safe strings for JWTs, or "Line Wrap" (RFC 2045) to split long outputs into 76-character blocks for MIME email compatibility.

  4. Select the character encoding charset (UTF-8, ASCII, or ISO-8859-1 / Latin-1) to ensure proper byte-level multi-byte character representation.

  5. Click "Encode" or press ⌘↵ (Ctrl+Enter on Windows/Linux) to execute the transformation instantly with live byte-size statistics and overhead ratios.

  6. For image files or SVG graphics, inspect the automatic inline visual preview rendered below the output panel upon decoding.

  7. Use the "Data URI" mode to generate complete `data:[mime];base64,...` strings for direct embedding in CSS `background-image` rules or HTML `<img>` elements.

  8. Copy the converted result to your clipboard with ⌘⇧C, download the output as a standalone file, or generate a gzip-compressed shareable URL for team debugging.

Base64 Encode/Decode Features

  • Standard RFC 4648 §4 Base64 Engine: High-performance client-side encoding and decoding with full UTF-8 Unicode and emoji support.

  • URL-Safe Base64 (Base64URL): Converts standard `+` and `/` characters to `-` and `_` and strips trailing `=` padding for JWTs and URL parameters.

  • Data URI Generator: Automatically detects MIME types from binary magic bytes (PNG, JPEG, GIF, WebP, SVG, PDF, WOFF2) to assemble `data:[mime];base64,...` embed strings.

  • Hexadecimal Bi-Directional Conversion: Convert between raw hexadecimal byte sequences and Base64 representations for cryptographic and low-level debugging.

  • MIME RFC 2045 Line Wrapping: Formats Base64 output into 76-character line segments with CRLF delimiters for SMTP email gateways and PEM certificates.

  • Multi-Charset Decoding Support: Decode Base64 byte arrays using UTF-8 (default), 7-bit ASCII, or Western European ISO-8859-1 (Latin-1) standards.

  • Binary File Upload & Download: Drag-and-drop any binary file up to multi-megabyte sizes to generate Base64 strings, or decode Base64 back into downloadable binary files.

  • Live Byte Metrics & Overhead Ratio: Real-time calculation of input byte length, output byte length, and exact encoding expansion multiplier (~1.33x).

  • Automatic Format Detection: Intelligent heuristic detector analyzes input syntax and prompts one-click decoding when Base64 content is detected.

  • Visual Image & Media Previews: In-browser visual rendering for decoded image formats (PNG, JPG, WebP, SVG, GIF) and font assets.

  • Gzip-Compressed Shareable Links: Compresses inputs into shareable URL parameters for seamless peer code review and collaborative debugging.

  • 100% Client-Side In-Memory Execution: All processing runs locally in browser memory via native TextEncoder/TextDecoder APIs with zero server transmission.

  • Developer Keyboard Shortcuts: Boost productivity with ⌘↵ (Run), ⌘⇧E (Force Encode), ⌘⇧D (Force Decode), ⌘⇧K (Clear), and ⌘⇧C (Copy).

  • REST API & Headless Execution: Programmatically encode and decode Base64 payloads via HTTP POST /api/tools/base64.

Supported Formats & Dialects

The Base64 Encode/Decode supports 6 syntax formats and dialects for accurate parsing and processing.

Standard Base64 (RFC 4648 §4)
The classical 64-character alphabet (A–Z, a–z, 0–9, +, /) with mandatory `=` padding for 3-byte alignment. Widely used in MIME email, HTTP Basic Auth, and general binary encoding.
URL-Safe Base64 / Base64URL (RFC 4648 §5)
URL and filename friendly variant replacing `+` with `-` and `/` with `_`, stripping `=` padding. Mandatory standard for JSON Web Tokens (JWT), OAuth 2.0 PKCE, and WebAuthn.
MIME Line-Wrapped Base64 (RFC 2045)
Base64 formatted with line breaks inserted every 76 characters to satisfy SMTP email transport gateway line limits and PEM certificate encoding conventions.
Data URI Scheme (Inline Assets)
Formatted as `data:[<mediatype>][;base64],<data>` for embedding images (PNG, JPEG, WebP, SVG), fonts (WOFF2), and audio directly into HTML, CSS, or JSON.
Hexadecimal Byte Stream Interchange
Dual-direction translation between Base64 and raw hex strings (`0x...`), widely used for inspecting cryptographic hashes, binary signatures, and network packets.
Multi-Charset Encodings (UTF-8, ASCII, Latin-1)
Character set handling supporting multi-byte UTF-8 Unicode (including emoji and international scripts), legacy 7-bit ASCII, and Western European ISO-8859-1 strings.
All Guides
developer tools

Converting cURL Commands to Clean Node.js, Python, and Go HTTP Clients

Transform raw cURL commands and browser network exports into production-ready JavaScript Fetch, Axios, Python Requests/HTTPX, and Go net/http code.

Read Field Manual
security crypto

Cryptographic Hash Functions in Modern Web Architecture: SHA-2, SHA-3, BLAKE2 & HMAC Guide

Master cryptographic hashing: evaluate collision resistance, benchmark SHA-2 vs SHA-3 vs BLAKE2, prevent length extension attacks with HMAC, and safely verify file checksums.

Read Field Manual
security crypto

Debugging JWT Errors: Fixing Signature Verification, Expiration & JWKS Failures

A comprehensive developer debugging guide to resolving JSON Web Token (JWT) errors: signature mismatches, expired tokens, alg: none attacks, clock skew, and JWKS key rotation.

Read Field Manual
developer tools

Mastering Number Base Conversions: Binary, Hex, Two's Complement & IEEE 754 Floating Point

A comprehensive developer guide to positional numeral systems, arbitrary-precision BigInt radix conversions, two's complement signed arithmetic, and IEEE 754 float inspection.

Read Field Manual
security crypto

Modern Password Hashing in 2026: Argon2id vs bcrypt vs PBKDF2 & OWASP Security Standards

Benchmark memory-hard Argon2id against bcrypt and PBKDF2, configure work factors for modern GPU resistance, avoid the 72-byte bcrypt truncation trap, and implement seamless on-login hash upgrades.

Read Field Manual
developer tools

Protobuf Debugging: Reading Wire-Format Errors & Binary Streams

A developer guide to Protocol Buffers wire format, decoding varints, resolving tag mismatches, and debugging corrupt binary gRPC and Kafka streams.

Read Field Manual
All Standards

Pre-built Automation Pipelines

Chain Base64 Encode/Decode with other utilities in a multi-step visual workflow.

beginner
encoding

Base64 Decode → JSON Format

Decode a Base64 string and pretty-print the JSON inside it.

Flow:
InputBase64 Encode/DecodeJSON FormatterOutput
4 nodes
intermediate
data-transformation

JSON → YAML → Base64

Multi-stage conversion for transport encoding.

Flow:
InputJSON FormatterYAML ConverterBase64 Encode/DecodeOutput
5 nodes
intermediate
database

Format SQL & Encode

Beautify SQL queries and encode for storage.

Flow:
InputSQL FormatterBase64 Encode/DecodeOutput
4 nodes

Frequently Asked Questions

What is RFC 4648 compliance and how does the 6-bit Base64 algorithm work?
RFC 4648 is the official IETF standard specification for Base64 data encoding. The algorithm converts binary data into ASCII text by dividing every 3 bytes (24 bits) into four 6-bit chunks called sextets. Each 6-bit number (0 to 63) is mapped to a character in the Base64 alphabet (A–Z, a–z, 0–9, +, /). Because 3 binary bytes are represented by 4 ASCII characters, Base64 encoding inherently increases data size by exactly 33.33% (4/3 ratio), plus optional line breaks.
What is URL-safe Base64 (Base64URL) and why is it required for JWTs and URLs?
Standard Base64 uses plus signs (`+`) and forward slashes (`/`), which collide with URL syntax: web servers interpret `+` as an encoded space character and `/` as a path segment delimiter. URL-safe Base64 (RFC 4648 §5) solves this by substituting `+` with `-` (hyphen) and `/` with `_` (underscore), and typically omitting trailing `=` padding characters. This format is required for JSON Web Tokens (JWT), OAuth 2.0 PKCE code challenges, and URL query parameters.
How does padding work in Base64 and what do `=` and `==` indicate?
Base64 processes input in 24-bit blocks (3 bytes). When an input byte count is not evenly divisible by 3, zero-bits are appended to complete the final 6-bit sextet, and padding characters (`=`) are added to maintain 4-character block alignment. A single `=` indicates that the final block contained 2 bytes (16 bits) of source data; `==` indicates the final block contained only 1 byte (8 bits). In unpadded Base64URL, padding is stripped because the missing bytes can be mathematically inferred from the string length.
Why does JavaScript btoa() throw an error with Unicode text and emojis, and how is it fixed?
The legacy browser `window.btoa()` function only accepts binary strings where each character code is within the 8-bit Latin-1 range (0x00 to 0xFF). When passed multi-byte UTF-8 characters like emojis (🚀) or non-Latin scripts, it throws a `DOMException: InvalidCharacterError`. To properly encode Unicode in modern JavaScript, text is first converted into a UTF-8 byte array using `new TextEncoder().encode(str)` before converting the binary buffer into Base64.
How do Data URIs work and what are the performance trade-offs of inlining Base64 assets?
A Data URI embeds file content directly into HTML or CSS using the syntax `data:[mime-type];base64,[data]`. Inlining assets eliminates the latency of separate HTTP requests and DNS lookups, which is beneficial for critical above-the-fold icons, SVGs, or standalone HTML emails. However, because Base64 adds ~33% byte overhead and prevents browser asset caching across different pages, large files should be hosted as independent media files.
How do you convert between Base64 and Hexadecimal representations?
Hexadecimal represents each byte as two 4-bit nibbles (`00` to `FF`), while Base64 represents every 3 bytes as four 6-bit sextets. Converting Base64 to Hex involves decoding the Base64 string into its underlying raw byte array and formatting each byte as a two-digit lowercase or uppercase hex string. This conversion is common when comparing cryptographic hash digests (like SHA-256) and binary signatures across different API standards.
Why does RFC 2045 MIME Base64 enforce 76-character line wrapping?
Legacy SMTP email transport protocols (RFC 821/2821) impose a strict maximum line length limit of 1000 characters. To prevent intermediate mail transfer agents (MTAs) from arbitrarily truncating or inserting unwanted line breaks into continuous binary streams, RFC 2045 mandates inserting a CRLF line break every 76 characters for Base64-encoded MIME email bodies, attachments, and PEM certificate containers.
Can Base64 encoding be used for data encryption or password security?
No. Base64 is strictly a public, deterministic binary-to-text encoding format, not an encryption algorithm. It provides zero secrecy, authentication, or protection against tampering. Anyone can instantly decode Base64 strings. Sensitive credentials, passwords, or personal data must always be encrypted with strong cryptographic algorithms (such as AES-256-GCM) or hashed with salted key-derivation functions (like Argon2id or bcrypt) prior to encoding.
How does client-side file encoding and decoding work without server upload?
The tool leverages modern browser HTML5 `FileReader` and `Uint8Array` APIs. When a file is dropped into the browser, its binary buffer is read directly in browser memory and converted to Base64 in JavaScript without making network requests. When decoding a binary Base64 string, the tool constructs a client-side `Blob` with the detected MIME type and generates a temporary `URL.createObjectURL()` link for direct local download.
How do JSON Web Tokens (JWT) and OAuth 2.0 PKCE use unpadded Base64URL?
A JSON Web Token (JWT) comprises three parts: header, payload, and cryptographic signature, joined by periods (`header.payload.signature`). Each JSON part is serialized and encoded using unpadded Base64URL (RFC 7519). Omitting `=` padding and replacing `+` and `/` guarantees the token can be transmitted safely within HTTP `Authorization: Bearer` headers, URI query strings, and cookies without requiring percent-encoding.

Developer Reference & Learning Hubs