DevBento logoDevBento
Home/Base64 Hub

Base64 Tools Hub

Everything Base64 in one place. Encode and decode text, convert images and files to Base64, generate data URIs, and learn how Base64 encoding works.

ALL BASE64 TOOLS
b64Base64 Encoder / Decoder
Encode and decode Base64 strings with UTF-8 support
imgImage to Base64
Convert JPG, PNG, SVG, WebP, GIF to Base64
pdfPDF to Base64
Encode PDF documents for APIs and storage
filFile to Base64
Encode any file type to Base64
audAudio to Base64
Convert audio files to Base64 strings
b64Base64 to Image
Decode Base64 strings back to images
b64Base64 to PDF
Convert Base64 back to downloadable PDFs
b64Base64 to File
Decode any Base64 string to its original file
cssCSS Background Image
Generate CSS with inline Base64 images
uriData URI Generator
Create data: URIs from any file
svgSVG to Base64
Encode SVG images for CSS and HTML embedding

What is Base64?

Base64 is a binary-to-text encoding scheme defined in RFC 4648. It represents binary data as a string of 64 printable ASCII characters: A-Z, a-z, 0-9, +, and /. The encoding is used whenever binary data needs to be transmitted over channels that only support text, such as email (MIME attachments), HTML/CSS (data URIs for inline images), JSON (embedding binary payloads), and URLs (query parameters containing binary data).

The name "Base64" comes from the fact that it uses 64 characters from the ASCII set. These 64 characters are enough to represent any binary value using a fixed number of bits (6 bits per character). The remaining 4 characters in ASCII (=, +, / and sometimes newline) have special roles: = is padding, and + and / are part of the 64-character set.

How Base64 Works

Base64 encoding takes every 3 bytes (24 bits) of input and splits them into 4 groups of 6 bits each. Each 6-bit value (0-63) maps to one character in the Base64 alphabet:

ValueCharacterValueCharacter
0A16Q
1B17R
2C18S
25Z51z
520619
62+63/

If the input length is not a multiple of 3, padding characters (=) fill the remaining positions. One padding byte means the last group had 2 bytes of real data; two padding bytes mean 1 byte.

Step-by-step example

Encoding the text "Man" (3 ASCII bytes: 77, 97, 110):

  1. Convert to binary: 01001101 01100001 01101110
  2. Split into 6-bit groups: 010011 010110 000101 101110
  3. Map to Base64 characters: T W F u
  4. Result: TWFu

Encoding "Ma" (2 bytes) produces TWE= with one padding character.

Base64 Is Not Encryption

This is the most common misconception about Base64. Base64 encoding does not protect your data. It does not use a key. It does not make data unreadable to anyone who encounters it. Base64 simply converts binary data to a text-safe format.

Anyone with a Base64 decoder (built into every programming language, every browser, every operating system) can reverse the encoding instantly. There is no password, no secret, no computational cost to decoding. A Base64-encoded string is as readable as the original data to anyone who knows what it is.

If you need to protect data in transit, use TLS/HTTPS. If you need to protect data at rest, use AES, RSA, or another proper encryption algorithm. Base64 is for transport safety (preventing corruption), not for security (preventing access).

Base64 Size Overhead

Base64 encoding increases data size by approximately 33%. The formula is:

encodedSize = ceil(inputSize / 3) × 4

Every 3 input bytes produce exactly 4 output characters. If the input is not a multiple of 3, padding adds characters but the output is still rounded up to the next multiple of 4.

Input SizeBase64 SizeOverhead
1 byte4 bytes+300%
3 bytes4 bytes+33%
100 bytes136 bytes+36%
1 KB (1,024 bytes)1,368 bytes+33.6%
10 KB13,340 bytes+33.4%
100 KB133,336 bytes+33.3%

When does the overhead matter?

For small files (icons, logos, UI sprites under 10 KB), the 33% overhead is usually worth the tradeoff because you avoid an HTTP request entirely. For larger files, the size penalty outweighs the request savings, and you are better off serving separate files with proper caching headers.

In gzip-compressed contexts (most HTTP responses), the overhead shrinks because Base64 output is highly repetitive and compresses well. A gzipped Base64 image in a CSS file is typically only 5-10% larger than the same image served as a separate file with gzip.

URL-Safe Base64

Standard Base64 uses + and / characters, which have special meaning in URLs. URL-safe Base64 (defined in RFC 4648 Section 5) replaces + with - and / with _, so the encoded string can be used directly in URLs and filenames without additional percent-encoding. This variant is used in JWTs, content hashes, and S3 bucket keys.

Base64 in Practice

Data URIs

A data URI wraps Base64 content with a MIME type so browsers can render it inline. The format is data:<mime-type>;base64,<encoded-data>. For example, data:image/png;base64,iVBOR... embeds a PNG image directly in HTML or CSS.

Email (MIME)

Email was designed for ASCII text. MIME uses Base64 to encode binary attachments (images, PDFs, executables) so they survive transit through text-only mail servers.

JSON and APIs

Some APIs accept binary payloads as Base64 strings in JSON fields. This is common for file upload endpoints, image data in REST responses, and cryptographic signatures in authentication flows.

Common Mistakes

🔒

Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.

© 2026 devbento.dev · built local-first