Base64 encoding step by step

发布于

本指南内容

This learning guide on Base64Encoding explains encode in plain language for developers and everyday users.

Everything important stays private: try the matching converter or tool in your browser — files and tokens are not uploaded.

Read the full English article below for code samples and edge cases, or switch language anytime from the menu. We keep expanding translations from real user feedback.

接着试用这些私密工具

Let’s encode the word Hi! and then Hi (which needs padding) by hand.

Example 1: “Hi!” (3 bytes, no padding)

Step 1 — characters to bytes. Using the ASCII table:

Character H i !
Decimal 72 105 33
Binary 01001000 01101001 00100001

Step 2 — join the bits:

010010000110100100100001

Step 3 — split into 6-bit groups:

010010 | 000110 | 100100 | 100001
  18   |    6   |   36   |   33

Step 4 — look up each number in the Base64 alphabet: 18 → S, 6 → G, 36 → k, 33 → h.

Result: Hi! → SGkh

Example 2: “Hi” (2 bytes, one = pad)

H        i
01001000 01101001

16 bits do not fill 24. Split into 6-bit groups and pad the last group with zero bits:

010010 | 000110 | 1001(00)
  18   |    6   |   36
   S   |    G   |    k

Only three characters carry data; one = marks the missing byte.

Result: Hi → SGk=

Example 3: “H” (1 byte, two = pads)

010010 | 00(0000)
  18   |    0
   S   |    A

Result: H → SA==

Non-ASCII text

Characters such as é or € are first converted to bytes with a character encoding, usually UTF-8. é becomes two bytes (C3 A9), so é encodes to w6k=. Different encodings give different Base64: in Windows-1252, é is one byte (E9) and encodes to 6Q==. That is why the text encoder lets you choose the character set.

Next: decoding step by step.

常见问题

Does this page upload my data?

No. Articles are static. Linked tools run locally in your browser unless a feature explicitly needs a network relay.

Can I request a translation or a new tool?

Yes — use the private feedback form. We prioritize what users ask for across languages.

What is the fastest way to try encode?

Open the homepage Base64 converter or the related tools linked on this page and paste a sample.

相关工具和指南

评论 (0)

对“Base64 encoding step by step”有疑问、想法或发现了 bug?欢迎留言评论、为工具评分或回复他人。

暂无评论,快来分享您的反馈吧!

发表评论

为此工具评分:
Esc
↑ ↓ 移动↵ 打开Esc 关闭