How To Use Base64 Encoding
📖 Bu rehber ToolPazar ekibi tarafından hazırlanmıştır. Tüm araçlarımız ücretsiz ve reklamsızdır.
Why encode binary as text
Base64 is the glue that lets binary data travel through text-only pipes. Email bodies, JSON payloads, URL parameters, HTML data attributes, and OAuth tokens were all designed for ASCII, which means a raw image or an encryption key can’t be dropped in verbatim—the random bytes will collide with control characters, get mangled by character-set conversions, or confuse a parser expecting newlines. Base64 rewrites bytes using a 64-character alphabet that survives every reasonable text transport, at the cost of roughly 33% size inflation. It is an encoding, not encryption—anyone can decode it. This guide covers the alphabet, how the three-byte-to-four-character math works, padding rules, the URL-safe variant, data URLs, and the decisions you’ll make around when the size tradeoff is worth it.
The alphabet
Base64 always inflates payloads by a factor of 4/3. A 1MB image becomes a 1.33MB string. Over the wire this is partially offset by gzip, which compresses Base64 text well, but the CPU cost of encoding, decoding, and decompressing adds up. For inline thumbnails and fonts, it’s fine. For user-uploaded photos in a mobile app, it’s wasteful compared to a multipart upload.
How the encoding math works
Anyone can decode Base64. It hides nothing—it is an encoding transformation, same category as hex. Storing a password “encrypted” in Base64 is equivalent to storing it in plain text. Use real cryptography (AES, libsodium, bcrypt for passwords). Base64 is only for moving bytes through text channels.