Base64 Encode / Decode

Text to Base64 and Base64 to text, UTF-8 and URL-safe.

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.

TextBytes (hex)Base64
Man4D 61 6ETWFu
Ma4D 61TWE=
M4DTQ==

Base64 alphabet

0–1516–3132–4748–63
0 A16 Q32 g48 w
1 B17 R33 h49 x
2 C18 S34 i50 y
3 D19 T35 j51 z
4 E20 U36 k52 0
5 F21 V37 l53 1
6 G22 W38 m54 2
7 H23 X39 n55 3
8 I24 Y40 o56 4
9 J25 Z41 p57 5
10 K26 a42 q58 6
11 L27 b43 r59 7
12 M28 c44 s60 8
13 N29 d45 t61 9
14 O30 e46 u62 +
15 P31 f47 v63 /

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

WhereDecodeEncode
Linux / macOSecho SGVsbG8= | base64 -dprintf Hello | base64
PowerShell[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("SGVsbG8="))[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("Hello"))
Pythonbase64.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.

Frequently asked questions

Why does my decoded Base64 show strange characters?

The original data may not be text (for example an image), or it was text in another encoding than UTF-8. Check also that no characters were lost when copying.

Does it work with emoji and non-English text?

Yes. Text is converted to UTF-8 bytes before encoding, so "héllo" becomes aMOpbGxv and decodes back exactly.

What does the = at the end mean?

It is padding added when the input length is not a multiple of 3 bytes. One = means the last group had 2 bytes, == means it had 1.

Is my data uploaded?

No. Encoding and decoding run in your browser.