Encodings

Base64

RFC 4648 base64. Three bytes as four characters padded with = and line breaks skipped on decode
IDbase6412 / 20base64 · 64 characters
Encoding / Base64

Base64

Three bytes as four characters. MIME, data URLs, PEM.

Overhead
+33% on random bytes
Padding
= to a whole block
Standard
RFC 4648 §4
Family
2 in base64
family 2 / 20

Sample

Out
aGVsbG8gd29ybGQh
Back
"hello world!"

Access

Importimport { base64 } from "@agntn/encodings/base64"
CLIencodings encode base64 'hello world!'
Tryplayground with the sample above
Kinbase64url

The one you've seen a million times. Three bytes, four characters, = to fill the last block.

ts
encode("base64", "hello world!");             // "aGVsbG8gd29ybGQh"
decode("base64", "aGVsbG8g\r\nd29ybGQh").bytes;  // "hello world!", line break and all skipped

Decoding skips whitespace, so a MIME body or a PEM block decodes as it is. It takes the text without padding too. The wrong padding, though? Zg= is one = short, and you'll hear about it. Characters from base64url are an error here, not a guess.