Questions
Where do I encode or decode?
The Base64 tool handles text and files in both directions, including URL-safe and unpadded input, and shows the decoded bytes as hex.
Everything about Base64 that is worth looking up, including the one-liners for each language.
| 0 A | 1 B | 2 C | 3 D | 4 E | 5 F | 6 G | 7 H |
| 8 I | 9 J | 10 K | 11 L | 12 M | 13 N | 14 O | 15 P |
| 16 Q | 17 R | 18 S | 19 T | 20 U | 21 V | 22 W | 23 X |
| 24 Y | 25 Z | 26 a | 27 b | 28 c | 29 d | 30 e | 31 f |
| 32 g | 33 h | 34 i | 35 j | 36 k | 37 l | 38 m | 39 n |
| 40 o | 41 p | 42 q | 43 r | 44 s | 45 t | 46 u | 47 v |
| 48 w | 49 x | 50 y | 51 z | 52 0 | 53 1 | 54 2 | 55 3 |
| 56 4 | 57 5 | 58 6 | 59 7 | 60 8 | 61 9 | 62 + | 63 / |
URL-safe (RFC 4648 §5): 62 = -, 63 = _, usually no padding. Padding char: =.
bytes: 01001000 01101001 00100001 "Hi!" 6-bit: 010010 000110 100100 100001 chars: S G k h "SGkh" "Hi" → 01001000 01101001 (16 bits) → 010010 000110 1001(00) → "SGk" + "=" "H" → 8 bits → 010010 00(0000) → "SA" + "=="
| Input length mod 3 = 0 | no padding |
| = 1 | 2 chars + == |
| = 2 | 3 chars + = |
| Output size | ⌈n / 3⌉ × 4 (≈ +33 %) |
| Input size from output | len × 3 / 4 − padding |
| MIME (RFC 2045) | lines of 76 chars, CRLF |
| PEM | lines of 64 chars |
| Base64 | A–Z a–z 0–9 + /; email, JSON, data: URLs |
| Base64URL | - and _ instead of + /; JWT, OAuth, file names |
| Base32 | A–Z 2–7; TOTP secrets, case-insensitive, +60 % |
| Base32hex | 0–9 A–V; sorts numerically (DNSSEC NSEC3) |
| Hex (Base16) | 0–9 a–f; +100 %, trivial to read |
| Base58 | no 0 O I l; Bitcoin addresses |
| Base85 / Ascii85 | +25 %; PDF, git binary diffs |
| bcrypt base64 | ./A–Z a–z 0–9, different order; only inside bcrypt hashes |
| base64 file; base64 -d | GNU coreutils (-w0 for no wrapping) |
| openssl base64 -A | OpenSSL (-A = single line) |
| echo -n 'text' | base64 | -n: no trailing newline in the input |
| base64.b64encode(b), b64decode(s) | Python; urlsafe_b64encode for URL-safe |
| btoa(s), atob(s) | JS, Latin-1 strings only; for UTF-8 use TextEncoder + fromCharCode, or Buffer in Node |
| Buffer.from(s).toString('base64'); Buffer.from(b64, 'base64') | Node.js ('base64url' also) |
| base64.StdEncoding.EncodeToString(b) | Go; RawURLEncoding for unpadded URL-safe |
| base64_encode(), base64_decode() | PHP |
| Base64.strict_encode64(s) | Ruby (encode64 wraps lines) |
| [Convert]::ToBase64String($bytes) | PowerShell |
| SELECT TO_BASE64('x'); encode('x','base64') | MySQL; PostgreSQL |
=, a URL-safe string fed to a strict decoder, or line breaks.data: URL is data:<mime>;base64,<data>.The Base64 tool handles text and files in both directions, including URL-safe and unpadded input, and shows the decoded bytes as hex.