Base64

Encodes text to Base64 and decodes back. Supports RFC 4648 standard and URL-safe variant; UTF-8 preserves Cyrillic and Unicode.

01Encoder02How it works03About04Questions05Related
01

Encoder

Mode
Charset
Variant
Wrap 76
Layout
Source text
Result · Base64
Result will appear here…
Input: 0 chars · Output: 0 chars
02

How it works

3 input bytes → 4 Base64 chars. Example: 'Hi' → SGk=
64 characters + = (padding for alignment)
A0
B1
C2
D3
E4
F5
G6
H7
I8
J9
K10
L11
M12
N13
O14
P15
Q16
R17
S18
T19
U20
V21
W22
X23
Y24
Z25
a26
b27
c28
d29
e30
f31
g32
h33
i34
j35
k36
l37
m38
n39
o40
p41
q42
r43
s44
t45
u46
v47
w48
x49
y50
z51
052
153
254
355
456
557
658
759
860
961
+62
/63
=pad
Step
'Hi'
'Hello'
1. Bytes (UTF-8)
48 65 6C 6C 6F
D0 9F D1 80 D0 B8 D0 B2 D0 B5 D1 82
2. Bits (groups 6)
010010 000110 0101 1100 …
110100 001001 111101 100000 …
3. Indices
18 · 6 · …
52 · 9 · 61 · 32 · …
4. Chars
S · G · V · …
0 · J · 9 · g · …
Result
SGVsbG8=
0J/RgNC40LLQtdGC
03

About Base64

Base64 is a byte-to-text encoding scheme. Every 3 input bytes become 4 characters from a set of 64 safe ASCII symbols. Output is ~33% larger than input.

The purpose of Base64 is to reliably transmit arbitrary data over text-only channels: email, JSON, XML, CSS, HTTP headers. It is not encryption — anyone can decode it back.

Standard Base64

RFC 4648
Hello → SGVsbG8=
Alphabet of 64 characters: A–Z, a–z, 0–9, + and /. If the input length is not a multiple of 3, the result is padded with = characters. Used in MIME, PEM certificates, Base64 strings in HTML.

URL-safe Base64

RFC 4648 §5
Hello → SGVsbG8 (no padding)
Modification for URLs and file names: + → −, / → _. Prevents conflicts with URL syntax. Used in JWT tokens, OAuth, Google API.

Character encoding

UTF-8: Cyrillic → 2 bytes per character
Base64 operates on bytes, not characters. UTF-8 preserves all Unicode (Cyrillic, CJK, emoji); Latin-1 only handles ASCII 0–255 — Cyrillic gets lost.

Where it's used

JWT · Data URI · SMTP · PEM · CSS · JSON API
Data URI — embedding images in HTML/CSS: src="data:image/png;base64,…". JWT — URL-safe Base64 header/payload. SMTP — email attachments. PEM — SSL certificates and keys.
04

Frequently asked questions

Paste the string and switch to decoding. Both the standard alphabet and the base64url variant are accepted — the one where `+` and `/` are written as `-` and `_` — and missing padding is added for you. Whitespace and line breaks inside the string are ignored, so pasting straight out of an email or a config file works.

Updated

«» added to favorites