Base64 Encoder (UTF-8 Safe)

Encode text, JSON, and Unicode to RFC 4648 Base64 locally · Zero server uploads

Presets:
UTF-8 Text Input 0 B
Base64 Output 0 B
Ready
0 B → 0 charsCmd/Ctrl+Enter
Advertisement
Reserved fixed-height slot (CLS = 0.00) 728×90 320×100 300×50

RFC 4648 Base64 Encoding & UTF-8 Byte Integrity

Base64 converts arbitrary binary data into a 64-character printable ASCII alphabet so payloads survive text-only transports such as JSON fields, MIME email bodies, XML attributes, and Kubernetes Secret manifests. Every 3 input bytes are split into four 6-bit indices, with one or two = padding characters appended when the input byte length is not divisible by 3.

In JavaScript, calling window.btoa() directly throws a DOMException whenever a string contains code points above U+00FF (such as curly quotes, CJK characters, or emoji). ByteHelpers encodes strings via TextEncoder into canonical UTF-8 bytes before Base64 grouping, matching OpenSSL, Python base64.b64encode, and Go encoding/base64 byte-for-byte.

  • AlphabetRFC 4648 §4 Standard Base64: A–Z, a–z, 0–9, +, / with = padding to 4-char blocks.
  • UTF-8 HandlingUses TextEncoder UTF-8 byte streams instead of legacy btoa(), preventing InvalidCharacterError on non-Latin1 characters.
  • Size OverheadMaps every 3 raw bytes (24 bits) to 4 ASCII characters (6 bits each), expanding payload length by ceil(n / 3) * 4 (~33.3%).
Why does Base64 increase my string size by about 33%?

Each Base64 character carries 6 bits of data inside an 8-bit ASCII byte. Encoding 3 input bytes (24 bits) always outputs 4 Base64 characters (32 bits), which is a 4/3 ratio plus up to 2 padding characters.

Is Base64 encoding a form of encryption?

No. Base64 is a reversible transport encoding with no secret key. Anyone can decode a Base64 string instantly, which is why Kubernetes Secrets stored as Base64 still require encryption at rest and RBAC controls.

When should I use Base64URL instead of standard Base64?

Use Base64URL whenever the encoded output appears inside a URL query parameter, filename, cookie, or JWT segment, because standard Base64 characters +, /, and = have reserved meanings in URLs.