Base64 Guides & Tutorials
Practical guides on Base64 encoding and decoding — from how it works to using it in every major programming language.
Concepts
Fundamentals
What is Base64 Encoding?
A complete explanation of the Base64 scheme, the 64-character alphabet, padding, and when to use it.
Fundamentals
URL-Safe Base64 (RFC 4648)
How URL-safe Base64 differs from standard Base64, and when to use it in JWTs, URLs, and filenames.
Use Case
Image to Base64 Data URI
Embed images directly in HTML and CSS using Base64 data URIs. When to use them and when to avoid.
Use Case
Base64 in JSON Web Tokens (JWT)
How JWTs use Base64URL encoding for headers, payloads, and signatures.
Comparison
Base64 vs Hex Encoding
When to choose Base64 over hexadecimal encoding, and vice versa. Size comparison and use case breakdown.
Use Case
Base64 Data URIs Explained
The data: URI scheme in depth — syntax, MIME types, browser support, and performance considerations.
Language Guides
JavaScript
Base64 in JavaScript
btoa(), atob(), TextEncoder, Buffer in Node.js, and handling Unicode strings correctly.
TypeScript
Base64 in TypeScript
Type-safe Base64 encoding and decoding in TypeScript for browser and Node.js environments.
Node.js
Base64 in Node.js
Using Node.js Buffer to encode and decode Base64 strings, files, and streams without external libraries.
Python
Base64 in Python
The base64 module, b64encode/b64decode, URL-safe variants, and encoding binary files in Python.
Java
Base64 in Java
java.util.Base64 encoder and decoder — basic, URL-safe, and MIME variants in Java 8+.
Go
Base64 in Go
encoding/base64 package — StdEncoding, URLEncoding, RawURLEncoding and working with byte slices.
Rust
Base64 in Rust
Using the base64 crate to encode and decode data in Rust with zero-copy efficiency.
PHP
Base64 in PHP
base64_encode(), base64_decode(), and handling URL-safe Base64 and binary file data in PHP.
C#
Base64 in C# (.NET)
Convert.ToBase64String, FromBase64String, and working with byte arrays and streams in .NET.
Ruby
Base64 in Ruby
Base64.encode64, strict_encode64, urlsafe_encode64 and the differences between them.
Swift
Base64 in Swift
Data.base64EncodedString() and Data(base64Encoded:) in Swift for iOS and macOS apps.
Kotlin
Base64 in Kotlin
java.util.Base64 in Kotlin, multiplatform approaches, and Ktor base64 utilities.
Need to encode or decode Base64 right now?
Use our free, instant Base64 tool — no ads, no tracking, keyboard shortcuts included.
Open base64.dev →