Skip to content

Encoding converters

Base64 Size Calculator

Calculate Base64 size online: enter text or a file size to get the exact encoded length, overhead %, padding, line-wrap and data URI totals — or paste an existing Base64 string and see exactly how many bytes it decodes to. All math, in your browser.

100% private · everything runs in your browser

Type text, give a file size — or paste an existing Base64 string and work backwards — and get the exact numbers: decoded size, encoded length, padding, line-wrap overhead and the data-URL prefix, with the overhead percentage and the formula spelled out. Everything is arithmetic in your browser; no data is uploaded or read.

Options

Input

0 B

0 characters · 0 bytes

Base64 output

0

0 bytes padded → 4-char groups

Side by side

Totals with options

The same bytes in every alphabet

Character counts for the identical input across the formats this site converts. All of these outputs are plain ASCII, so characters equal bytes on the wire — Base85 comes out shorter per symbol while hex costs double, padding included where the standard demands it.

Budget planner — the other direction

Sizing limits usually arrive after the fact (a 4096-character HTTP header, a database column, an email line). Say how much space the and this works the formula backwards to the largest input that still fits.

How to use

Base64 Size Calculator, step by step

  1. 01

    Type or paste text in "Text" mode — the calculator counts the real UTF-8 bytes (multi-byte scripts and emoji are counted properly, as bytes, not characters) and shows the exact Base64 output size as you type.

  2. 02

    Switch to "File size" mode to size any file before converting: enter a byte/KB/MB value or drop a file on the zone — the file name and size are read, but the content never is.

  3. 03

    Turn on line wrapping (PEM 64 or MIME 76) to see how CR-LF newlines add to the total, and read the data-URL total for the moment you paste the output into CSS or HTML.

FAQ

Frequently asked questions

The exact formula is ceil(bytes ÷ 3) × 4, plus the same count again for the \r\n of every line break if you wrap at 64 (PEM) or 76 (MIME) characters. Padding depends on the remainder: bytes % 3 = 0 adds no "=", 2 adds one, 1 adds two. The calculator applies the real formula to your number and shows the padding breakdown, not just the 33% rule of thumb.

Paste it in the "Base64 string" tab. The decoded size equals ceil(3n ÷ 4) for n non-padding characters, minus nothing extra — the trailing = characters mark bytes already counted, and malformed inputs (wrong length, a stray = mid-string) are reported precisely. Wrapped PEM/MIME input is normalized first; a data: URI is recognized and its MIME prefix is counted separately.

The raw file. Base64 text compresses worse than the binary it encodes, because a 64-symbol alphabet carries less information per byte than arbitrary binary data: gzip normally saves the wasted information again, but it rarely beats the compressed size of the original. The honest planning number is the pre-compression byte count shown in this calculator, not the post-gzip one.

Base64 re-groups your bytes into 6-bit chunks and stores each chunk as one character. Two bytes (16 bits) of input become roughly 2.67 characters, so 3 bytes become exactly 4 characters and the output is trending 4⁄3 — about 33% larger, plus a byte or two of = padding when the input length is not a multiple of 3.

Not necessarily. The encoder works on bytes, and Unicode text can need more than one byte per character — "é" in UTF-8 is 2 bytes, "中" is 3, an emoji is 4. This calculator measures the real bytes with TextEncoder, so a Chinese or emoji-heavy string costs more than its displayed character count suggests.

PEM wraps at 64 characters and MIME at 76; both use CRLF (\r\n) between lines, which is 2 bytes per break. A 1 MB payload wrapped at 76 adds about 27 KB of pure newlines. The calculator counts them exactly for the width you choose.

Because data URIs are copied character-for-character into HTML, CSS and JavaScript — and those go through gzip/brotli in fewer bytes only. A 500 KB screenshot inlines as roughly 667 KB of source text; emails that MIME-encode attachments grow the same way, which is why the calculator also shows the wrapped total.

No. Text sizes are computed with the browser’s own TextEncoder and files are measured via their File object. Content is neither read into memory for the file-size mode nor transmitted anywhere — nothing leaves your device.

Base58 and Base62 are number encodings, not block encodings: the output length depends on the actual value (leading zero bytes expand specially, and each byte carries log2(58) bits rather than a clean block). The calculator shows the worst-case character count from the standard byte-efficiency formula; Base64, Base32, hex and Ascii85 rows are exact by construction.

It inverts the encoding formula: you say how many characters the encoded output may occupy (a 4096-character HTTP header, a database column limit, an email body line) and it returns the largest input whose Base64 — optionally data-URL-wrapped and line-wrapped — still fits. It is arithmetic, not encoding; nothing runs against your data.

Ascii85 packs four bytes into five characters — 25% overhead — versus the 33% of four-chars-per-three-bytes Base64. The trade is alphabet fragility: Base85 characters include quotes and other punctuation that breaks JSON, HTML attributes and URLs, which is why Base64 stayed ubiquitous. The comparison chart above makes the cost visible for every alphabet side by side.

Related tools

esc

Tools

Pages

↑↓ navigate↵ open⌘K

Keyboard shortcuts

Same shortcuts everywhere — ⌘ on macOS, Ctrl on Windows and Linux.