Base64, HTML Entities & Encoding for Developers (2026)

Base64, HTML entities and URL encoding with measurements: Base64 adds 33.3% to 33.6% depending on size, and Chromium's HTML parser shows which unescaped characters really break a page, including an ampersand that turned "© right" into "© right".

DG
Derek Giordano
Designer & Developer

Base64: What It Costs

Base64 turns every 3 bytes into 4 printable characters from a 64-character alphabet (RFC 4648), so text-only channels such as email bodies, JSON and data URIs can carry binary data. The price is size. Encoding random data of three sizes gave:

InputBase64Overhead
1,000 bytes1,336 characters33.6%
10,000 bytes13,336 characters33.4%
100,000 bytes133,336 characters33.3%

The overhead settles at a third, plus up to two padding characters. Gzip on the page wins some of it back, but the file can no longer be cached on its own, so inline only small images that every visit needs, such as an icon in critical CSS. URL-safe Base64 (Base64url) swaps + and / for - and _ so tokens survive in URLs; JSON Web Tokens use it.

HTML Escaping: What Actually Breaks

Advice often says five characters must always be escaped. We parsed each case with Chromium's own HTML parser to see what really changes the result:

Written asWhereWhat the parser produced
5 > 3textunchanged
Tom & Jerrytextunchanged
AT&Ttextunchanged
&copy righttextbecame © right
&copyrighttextbecame ©right
a <b ctextbecame an element; text cut to a
He said "hi"textunchanged
a "b" cdouble-quoted attributebecame a

So in text, < must always be escaped, and & must be escaped whenever letters follow it: the parser still decodes old named references without a semicolon, so "&copy right" silently became "© right". Inside an attribute, escape the quote character that delimits it. > and quotes in plain text are harmless, but escaping all five everywhere is the simple rule that never fails, and it is what our HTML Entity Encoder does by default; its decoder matched Python's html.unescape on 12 of 12 test strings.

URL Encoding

Percent-encoding writes a byte as % plus two hex digits; non-ASCII text is first turned into UTF-8 bytes, so "é" becomes %C3%A9. In JavaScript, encodeURIComponent() is for one value (a query parameter or path segment) and encodeURI() for a whole URL, which it leaves usable by not touching / ? & =. Our URL encoding guide compares encoders and how live servers treat the different spellings.

Our Encoding Tools, Tested

Browse all utility tools →
⚡ Try the free Email Template Builder →
🔄
Try Base64 Encoder
Free, no signup →