Loading...
Loading...
Free online Base64 encoder and decoder — encode text and files to Base64, decode Base64 back to readable text. Supports URL-safe and standard variants.
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format using a base-64 representation. It works by grouping 3 bytes (24 bits) of binary data into 4 groups of 6 bits each, then mapping each 6-bit value to a character in the Base64 alphabet (A-Z, a-z, 0-9, +, /). The = character is used for padding when the input length is not divisible by 3.
Encoding uses specific character sets. Standard Base64 uses A-Z, a-z, 0-9, +, and /. URL-safe Base64 replaces + with - and / with _, making the output safe for use in URLs and filenames without percent-encoding. Both variants use = for padding so the output length is always a multiple of 4.
Common use cases for Base64 include: embedding images directly in HTML or CSS as data URIs (data:image/png;base64,...), encoding binary attachments for email (MIME), storing binary data in JSON where the text format expects strings, encoding cryptographic keys and certificates for storage in text-based formats like PEM (which is Base64 with headers and line wrapping), and passing binary data through systems that only support text (like older database columns).
A common misconception is that Base64 is a form of encryption. It is not. Base64 is encoding — the transformation is fully reversible by anyone, requires no key, and provides no security whatsoever. Treat Base64 as a transport encoding, not a security measure. If you need confidentiality, encrypt the data with a proper algorithm (AES, ChaCha20) before Base64-encoding it.
There are several Base64 variants in common use: Standard Base64 (RFC 4648 §4) uses the standard alphabet with padding, URL-safe Base64 (RFC 4648 §5) uses - and _ with optional padding, MIME Base64 (RFC 2045) uses standard alphabet with 76-character line breaks for email, and PEM Base64 uses MIME-style encoding with headers and 64-character lines. The term 'Base64' usually refers to the standard variant. Choose the variant that matches your transport requirements.
No. Base64 is encoding, not encryption. Anyone can decode Base64 instantly using any number of free online tools or a single line of code (atob() in JavaScript, base64.b64decode() in Python). It is designed to make binary data text-safe for transport, not to hide content or provide security.
Base64 encodes 3 bytes into 4 characters. If the input byte count is not divisible by 3, padding characters (=) are added to make the output length a multiple of 4. One = means the input had 2 extra bytes (16 bits), == means 1 extra byte (8 bits).
Yes, but with caveats. Base64-encoded images can be embedded directly in HTML as data URIs: <img src='data:image/png;base64,...'>. However, Base64 increases size by approximately 33%, so embedded images are best suited for small assets like icons. For larger images, serving them as separate files is more efficient and allows browser caching.
URL-safe Base64 (base64url) replaces + with - and / with _ to prevent issues in URLs and filenames where + is interpreted as a space and / as a path separator. It also typically omits padding (=) for compactness. Most modern web API Base64 implementations support both variants.
All three encode binary data as text but with different efficiencies. Base64 encodes 3 bytes into 4 characters (33% overhead). Base32 encodes 5 bytes into 8 characters (60% overhead) but uses only alphanumeric characters (no +/=). Base16 (hexadecimal) encodes 1 byte into 2 characters (100% overhead) but is the most human-readable.