What is Base64 encoding used for?
Base64 turns any bytes into plain letters, digits, + and /, so binary data can travel through systems that only handle text. Common uses are email attachments (MIME), images embedded in HTML or CSS as data URIs, HTTP Basic authentication headers and the parts of a JWT token.
How does Base64 work?
The input is split into groups of 3 bytes (24 bits), and each group is written as 4 characters of 6 bits from a 64-character alphabet. If the last group is short, it is padded with =. That is why Base64 output is about 33% larger than the input.
| Text | Bytes (hex) | Base64 |
|---|---|---|
| Man | 4D 61 6E | TWFu |
| Ma | 4D 61 | TWE= |
| M | 4D | TQ== |
Base64 alphabet
| 0–15 | 16–31 | 32–47 | 48–63 |
|---|---|---|---|
0 A | 16 Q | 32 g | 48 w |
1 B | 17 R | 33 h | 49 x |
2 C | 18 S | 34 i | 50 y |
3 D | 19 T | 35 j | 51 z |
4 E | 20 U | 36 k | 52 0 |
5 F | 21 V | 37 l | 53 1 |
6 G | 22 W | 38 m | 54 2 |
7 H | 23 X | 39 n | 55 3 |
8 I | 24 Y | 40 o | 56 4 |
9 J | 25 Z | 41 p | 57 5 |
10 K | 26 a | 42 q | 58 6 |
11 L | 27 b | 43 r | 59 7 |
12 M | 28 c | 44 s | 60 8 |
13 N | 29 d | 45 t | 61 9 |
14 O | 30 e | 46 u | 62 + |
15 P | 31 f | 47 v | 63 / |
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in URLs. The URL- and filename-safe variant in RFC 4648 section 5 replaces them with - and _ and usually drops the = padding. Tick URL-safe to produce it; the decoder accepts both forms.
How to decode Base64 in Linux, PowerShell and Python
| Where | Decode | Encode |
|---|---|---|
| Linux / macOS | echo SGVsbG8= | base64 -d | printf Hello | base64 |
| PowerShell | [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("SGVsbG8=")) | [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("Hello")) |
| Python | base64.b64decode("SGVsbG8=").decode() | base64.b64encode(b"Hello") |
On older macOS versions the decode flag is -D.
Is Base64 encryption?
No. It is an encoding with no key; anyone can decode it in one step. Do not use it to hide passwords or personal data.
How do I make a data URI from an image?
Switch to Encode and choose a file with "File → data URI". The output starts with data:image/png;base64, and can be pasted into an HTML src or a CSS url(). Files stay in your browser; the limit here is 5 MB.
Sources: RFC 4648, The Base16, Base32, and Base64 Data Encodings · RFC 2397, The "data" URL scheme. Checked October 2026.