Quick answer: “Hello” in Base64 is SGVsbG8=; the Arabic word “مرحبا” (10 bytes in UTF-8) becomes 2YXYsdit2KjYpw==.
How it's calculated
Base64 (RFC 4648) writes binary data with 64 safe characters: A–Z, a–z, 0–9, + and /. Every 3 bytes become 4 characters, so the output is about a third longer; “=” pads the end when the byte count is not a multiple of 3.
Text is first turned into bytes with UTF-8. English letters take one byte each, Arabic letters two, and most emoji four, which is why Arabic text produces a longer Base64 string.
The URL-safe alphabet replaces + and / with - and _ and drops the padding, for use in web addresses and tokens. Base64 is an encoding, not encryption: anyone can decode it.
Worked examples
- Hello → SGVsbG8=
- مرحبا → 2YXYsdit2KjYpw==
- SGk= → Hi
Examples
| Text | Base64 |
|---|---|
| Hi | SGk= |
| Hello | SGVsbG8= |
| مرحبا | 2YXYsdit2KjYpw== |
| سلام | 2LPZhNin2YU= |
| SahlCalc | U2FobENhbGM= |
Frequently asked questions
Is Base64 secure?
No. It only changes the form of the data and can be decoded by anyone. Use encryption to protect information.
Why does my decoded text show strange characters elsewhere?
The original was probably encoded from a different character set, such as Windows-1256. This tool decodes UTF-8, the web standard.
Is my text sent anywhere?
No. Encoding and decoding happen in your browser.
How much longer is Base64 than the original?
About a third longer. Every 3 bytes turn into 4 characters, so 300 bytes come out as 400, sometimes with one or two = signs on the end.
Where is Base64 used?
Anywhere binary data has to travel as plain text: email attachments, images embedded in web pages, JSON web tokens and login details in HTTP headers.
What is the URL-safe alphabet for?
Normal Base64 uses + and /, and both mean something special in a web address. The URL-safe version swaps them for - and _ and usually drops the = padding, so you can put the result straight into a link or a file name.