Encoding

Base64 encoding is not encryption

Understand Base64 text, padding, UTF-8, data URLs, and the size trade-off before embedding binary data in an API request.

Open Base64 Encoder/Decoder

A representation anyone can reverse

Base64 lets bytes travel through systems designed to carry text. It is useful when an API explicitly expects a binary attachment inside a JSON string. It does not use a secret key, so it does not keep the contents confidential. A password in Base64 is still an exposed password.

Encoding, encryption, and hashing solve different problems. Encryption protects confidentiality through a cryptographic scheme and keys. A cryptographic hash produces a digest for uses such as integrity checks; it is not a reversible file format. Base64 simply changes how the same bytes are written.

Follow a small text round trip

In Base64 Encoder/Decoder, choose Encode and enter Hello. The result is SGVsbG8=. Choose Decode and paste that result to recover Hello. The equals sign supplies padding to complete the final encoding group; it was not present in the source text.

Text must first become bytes. Zentoolia uses UTF-8, so accented characters and emoji can be encoded too. If another program assumes a different character encoding when it reads the decoded bytes, it may display unexpected characters even though Base64 itself was decoded correctly.

UTF-8 text: Hello
Base64:     SGVsbG8=
Decoded:    Hello

A decoded file does not have to be readable text

Upload a small raster image in Encode mode and the result represents the image’s bytes, not a textual description of the picture. Decoding it may produce an image preview and a download. Other binary formats may offer only a file download because the bytes do not form valid UTF-8 text.

A data URL puts a media-type label and encoding marker before the payload. In the example below, only SGVsbG8= is the encoded data. The label describes the intended type; it is not proof that the bytes are harmless or even of that type. Treat an unknown decoded download with the same care as any other file from an unknown source.

data:text/plain;base64,SGVsbG8=

Budget for the larger payload

Standard padded Base64 needs 4 × ceil(byteLength / 3) characters. Three input bytes become four text characters. For a 3 MiB file, that is 4 MiB of Base64 before a data-URL prefix, JSON structure, or line wrapping. It is a representation for compatibility, not compression.

This matters when an API or proxy imposes a request-size limit. Check whether the limit counts the binary file or the final HTTP body. If the API supports a binary or multipart upload, that may be a better fit than putting a large encoded string inside JSON. Zentoolia limits encoding uploads and decoded output to 5 MB to bound browser memory use.

Match the alphabet expected by the receiver

Traditional Base64 uses + and /, while Base64URL substitutes - and _. Some protocols also omit padding. JWT sections use Base64URL. Do not replace characters, strip padding, or add a data-URL prefix unless the receiving protocol expects that representation.

When decoding fails, check whether you copied surrounding quotation marks, truncated the last group, or supplied an entire JSON response instead of its encoded property. When a receiver rejects a successful encoding, compare its requirements for raw Base64, data URLs, and Base64URL. Test a tiny known value before retrying a large file.

Further reading

Browse all guides · Suggest a correction