Base64 is a way of writing any data, whether text, an image or a PDF, using only 64 plain characters: A–Z, a–z, 0–9, + and /. It exists because many systems, from email to JSON to HTML, were built to carry text and can corrupt raw binary bytes.
The most important thing to know is that Base64 is encoding, not encryption. It hides nothing. The Base64 Encode / Decode tool on BISCS India converts both ways in your browser, handles Hindi, Bengali and emoji correctly, and can turn whole files into Base64 strings.
How does Base64 work?
Computers store data as bytes of 8 bits. Base64 takes 3 bytes (24 bits) at a time, splits them into four 6-bit groups, and maps each group to one of 64 characters. When the input length is not a multiple of 3, the output is padded with one or two = signs.
The word Hi! is three bytes, so it becomes exactly four characters:
Hi! -> SGkh
Hello -> SGVsbG8=
Because 3 bytes become 4 characters, Base64 output is always about one third larger than the input.
Where you will meet Base64
- Data URLs. Small images embedded directly in CSS or HTML, such as
data:image/png;base64,iVBORw0…. - Email attachments. MIME email encodes attachments in Base64, wrapped at 76 characters per line.
- JSON Web Tokens. The header and payload of a JWT are base64url-encoded JSON.
- HTTP Basic authentication. The
Authorization: Basic …header carriesusername:passwordin Base64, which is exactly why it must only be sent over HTTPS. - APIs that accept files. Some government and business APIs, including several used for e-invoicing and document upload, expect file contents as a Base64 string inside JSON.
Encoding is not encryption
This is the mistake that causes real security incidents. A developer stores an API key or password as Base64 in a config file or front-end code, thinking it is "encrypted". It is not. Decoding it is one click:
atob('cGFzc3dvcmQxMjM='); // "password123"
Use Base64 to make data transportable, never to make it secret. For secrecy you need encryption with a key; for storing passwords you need a slow password hash such as bcrypt or Argon2.
How to encode or decode with BISCS India
- Open Base64 Encode / Decode.
- Choose Encode or Decode at the top.
- Type or paste your text into the left box. The result appears instantly on the right, with the byte size of each side.
- Optional: tick URL-safe (- _ no padding) for base64url output, or Wrap lines at 76 chars for email-style formatting.
- Use Swap to send the output back to the input and flip the mode, which is a quick way to check a round trip.
- Click Copy, or Download to save the result. When decoding binary data, Download saves the original bytes.
Encoding a file
Scroll to File to Base64, choose a file (up to 25 MB) and the Base64 appears in the output box. Keep Include data: URL prefix ticked if you want a ready-to-use data: URL, or untick it for the bare Base64 string that most APIs expect. For images specifically, the Image to Base64 tool adds previews and ready-made HTML and CSS snippets.
Unicode: why the Sample uses ₹ and नमस्ते
The browser’s built-in btoa() function throws an error on any character outside Latin-1, which rules out Hindi, Tamil, the rupee sign and emoji. The correct approach is to convert the text to UTF-8 bytes first:
const bytes = new TextEncoder().encode('₹ नमस्ते');
const b64 = btoa(String.fromCharCode(...bytes));
The tool does this for you. When decoding, it checks that the bytes are valid UTF-8. If they are not, it shows a warning that the data is binary and offers a download instead of printing gibberish.
Standard vs URL-safe Base64
| Aspect | Standard | URL-safe (base64url) |
|---|---|---|
| Characters 62 and 63 | + and / |
- and _ |
| Padding | = at the end |
Usually omitted |
| Used in | Email, data URLs, most APIs | JWTs, URL parameters, file names |
The decoder accepts either variant, ignores whitespace and line breaks, and strips a leading data:…;base64, prefix automatically.
How do I tell if a string is Base64?
There is no foolproof test, because many ordinary words are technically valid Base64. But a few signs are strong hints:
- The string uses only letters, digits,
+and/(or-and_for the URL-safe form), with no spaces. - Its length is a multiple of 4, often ending in one or two
=signs. - It starts with a familiar prefix.
iVBORw0KGgois the start of every PNG image,/9j/is a JPEG,JVBERi0is a PDF, andeyJis how JSON beginning with{"followed by a letter usually encodes, which is why so many tokens start with those three letters.
The quickest check is to paste it into the decoder. If the result is readable text or JSON, you have your answer. If the tool reports binary data, use Download and open the file to see what it contains.
Common mistakes with Base64
- Treating it as security. Covered above, but worth repeating.
- Embedding big images as data URLs. The 33% size increase and loss of browser caching usually make pages slower. Inline only tiny icons.
- Double encoding. Encoding an already-encoded string produces valid but useless output. If a decoded result still looks like Base64, it was encoded twice.
- Mixing up Base64 and URL encoding. A
+in standard Base64 inside a URL may be read as a space. Use URL-safe Base64, or percent-encode the string with the URL Encode / Decode tool. - Breaking padding. Removing or adding
=characters by hand can make strict decoders reject the string.
Privacy
Encoding happens in your browser with JavaScript. Text you type and files you select are never uploaded. That matters, because the strings people decode are often tokens and credentials. If you are inspecting a JWT, the JWT Decoder splits it into header and payload for you, again without sending it anywhere.