What is Base64?

Base64 represents binary bytes with a limited text alphabet. It is useful when a system accepts text but needs to carry bytes. Because it is reversible and contains no key, Base64 is encoding—not encryption.

How UTF-8 text is encoded

Unicode text is first converted to UTF-8 bytes with TextEncoder. Those bytes are then grouped into Base64 characters. Decoding reverses the process with a strict UTF-8 decoder, avoiding the Latin-1 limitation of calling btoa() directly on arbitrary text.

Base64 vs Base64URL

Standard Base64

Uses + and /, normally with = padding. It is common in files, email formats, and data URLs.

Base64URL

Uses - and _ and often omits padding, making it convenient inside URLs and tokens such as JWTs.

Why Base64 increases size

Four Base64 characters represent three input bytes, producing roughly 33% overhead before surrounding formats or padding. It should not replace compression.

Frequently asked questions

Is decoded content executed?

No. Valid UTF-8 is displayed as escaped text. Binary or invalid UTF-8 is identified without invented output.

Can Base64URL omit padding?

Yes. This decoder restores valid missing padding when Base64URL mode is selected.