How Base64 encoding works
Base64 takes your data 3 bytes (24 bits) at a time and splits it into four groups of 6 bits. Each 6-bit group is a number from 0 to 63, which is written as one character from the Base64 alphabet. If the data does not divide evenly into 3 bytes, = signs are added as padding.
| Text | Base64 |
|---|---|
Hello | SGVsbG8= |
SoftDotCom | U29mdERvdENvbQ== |
پاکستان | 2b7Yp9qp2LPYqtin2YY= |
Where developers use Base64
- HTTP Basic authentication: the
Authorizationheader carriesusername:passwordin Base64. - JWT tokens: the header and payload are URL-safe Base64. Paste a part here and choose Decode to read it.
- Data URIs: small images and fonts embedded directly in HTML or CSS.
- Email attachments (MIME) and binary data inside JSON or XML.
Frequently asked questions
What is Base64?
Base64 is a way of writing any data, including binary files, using only 64 safe text characters (A–Z, a–z, 0–9, + and /). It is used to put images in HTML or CSS, send attachments in email, and pass data in JSON, URLs and HTTP headers.
Is Base64 encryption?
No. Base64 is an encoding, not encryption: anyone can decode it instantly. Never use it to hide passwords or secrets.
What is URL-safe Base64?
It replaces + with - and / with _ and usually removes the = padding, so the result can be used safely in URLs and file names. JSON Web Tokens (JWT) use URL-safe Base64.
Why does Base64 make data bigger?
Every 3 bytes of data become 4 Base64 characters, so encoded data is about 33% larger than the original.
Can I convert an image to Base64?
Yes. Choose a file in the file section to get its Base64 string and a ready-to-use data URI (for example data:image/png;base64,…) for HTML or CSS. Small icons are the best use; large images are better as normal files.
More free developer tools
Looking for work? Browse the latest software developer and IT jobs in Pakistan, including remote jobs, or see all free tools.
Last reviewed 10 November 2026.