This developer guide on Base64Encoding explains developers in plain language for developers and everyday users.
Everything important stays private: try the matching converter or tool in your browser — files and tokens are not uploaded.
Read the full English article below for code samples and edge cases, or switch language anytime from the menu. We keep expanding translations from real user feedback.
Every mainstream language ships a Base64 implementation, but they differ in the details that cause bugs: Unicode handling, URL-safe alphabets, padding, line breaks and strictness. These guides show the idiomatic way to do it in each language, and the traps to avoid.
Quick reference
Language
Encode
Decode
JavaScript (browser)
btoa(binary) / Uint8Array.prototype.toBase64()
atob(b64) / Uint8Array.fromBase64()
Node.js
Buffer.from(data).toString('base64')
Buffer.from(b64, 'base64')
Python
base64.b64encode(data)
base64.b64decode(b64)
PHP
base64_encode($data)
base64_decode($b64, true)
Java
Base64.getEncoder().encodeToString(bytes)
Base64.getDecoder().decode(b64)
C#
Convert.ToBase64String(bytes)
Convert.FromBase64String(b64)
Go
base64.StdEncoding.EncodeToString(b)
base64.StdEncoding.DecodeString(s)
Bash
base64 -w0 file
base64 -d file
Three rules that prevent most Base64 bugs
Base64 encodes bytes, not text. Convert strings to bytes with an explicit character set (almost always UTF-8) before encoding, and back after decoding.
Know your alphabet. URLs, JWTs and file names use Base64URL (- and _, usually no padding). Standard decoders reject it.
Be strict when validating, lenient when reading. Reject malformed input from APIs, but strip whitespace and data URI prefixes when users paste values.
Comentarii (0)
Întrebări, idei sau o eroare în „Base64 for developers”? Lăsați un comentariu, evaluați instrumentul sau răspundeți altora.
Nu există încă comentarii. Fiți primul care își împărtășește părerea!