CIRCUITO
CARIOCA TI · DOCUMENTATION
♙
Developer tool

Base64 Encoder & Decoder

Encode text or bytes as standard Base64 or Base64URL and decode Base64 with strict validation, padding checks and safe handling of binary output.

Base64Base64URLRFC 4648EncodeDecodeMIMEUTF-8

Base64 encode and decode

Choose standard Base64 or the URL-safe alphabet. Processing happens on this web server, so do not paste passwords, private keys, access tokens or other secrets into a public online tool.

Maximum input: 1 MiB.
BASE64 · RFC 4648

What Base64 is

Base64 is a binary-to-text encoding. It takes groups of input bits and represents them with a restricted text alphabet. Standard Base64 uses A–Z, a–z, 0–9, + and /, with = used for padding when needed. The transformation is reversible and provides no confidentiality.

NOT ENCRYPTION

Base64 does not protect secrets

Anyone who receives Base64 data can normally decode it without a key. Encoding a password, API key, cookie, token or private data as Base64 does not encrypt it. Security must come from the surrounding protocol and controls — for example TLS in transit and appropriate cryptographic protection or secret storage when required.

3 BYTES → 4 CHARS

Why Base64 usually grows by about one third

Base64 represents every 24 input bits — three bytes — as four symbols carrying six bits each. For large inputs, that changes 3 bytes into 4 encoded characters, producing approximately 33.3% overhead before optional line wrapping or surrounding protocol syntax. Small inputs can have a larger percentage overhead because of padding.

PADDING =

What the = characters mean

Padding completes the final four-character Base64 quantum when the number of input bytes is not a multiple of three. RFC 4648 requires appropriate padding in the general case unless the specification that uses Base64 explicitly states that padding is unnecessary or omitted. This tool therefore lets you control unpadded input/output rather than silently assuming one convention.

BASE64URL

Base64URL uses a different alphabet

RFC 4648 defines a URL- and filename-safe Base64 alphabet where + is replaced by - and / is replaced by _. Base64URL is not simply a display preference: a decoder must know which alphabet the surrounding format expects. Some protocols also omit trailing = padding.

STRICT DECODING

Why strict validation matters

PHP base64_decode() has a strict mode that rejects characters outside the Base64 alphabet instead of silently discarding them. This page adds checks for alphabet, length, padding position and canonical round-trip representation. Strict handling is useful when malformed data should be treated as an error rather than quietly repaired.

MIME · RFC 2045

Why MIME Base64 can contain line breaks

MIME Base64 for email has transport-oriented line rules and permits decoding software to ignore line breaks and other whitespace in that context. RFC 4648, by contrast, says implementations must not add line feeds unless the referring specification directs them to do so. The decoder therefore offers a separate MIME-style whitespace option instead of treating whitespace as universally valid.

BINARY OUTPUT

Decoded Base64 is bytes, not necessarily text

A Base64 decoder returns the original byte sequence. Those bytes might represent UTF-8 text, an image, compressed data, a certificate, executable data or any other binary format. PHP explicitly documents that decoded output may be binary. When this page detects output that is not safely displayable UTF-8 text, it shows the bytes in hexadecimal instead of pushing arbitrary binary data into the HTML page.

HTTP BASIC · RFC 7617

HTTP Basic uses Base64, but Base64 is not its security layer

HTTP Basic authentication constructs user-id:password and Base64-encodes the resulting octets. RFC 7617 explicitly warns that Basic authentication is not secure by itself because Base64 does not protect the credentials. In practice, Basic authentication should only be used with an external secure transport such as HTTPS/TLS and appropriate operational controls.

TEXT ENCODING

Base64 encodes bytes; UTF-8 defines how text becomes bytes

Base64 itself does not define whether source text is UTF-8, ASCII, ISO-8859-1 or another character encoding. The same visible characters can produce different byte sequences under different character encodings. Web applications normally work with UTF-8, but interoperability depends on both sides agreeing on the text-to-byte encoding before Base64 is applied.

FAQ

Base64 encoder and decoder frequently asked questions

Does Base64 encrypt data?+

No. Base64 is a reversible binary-to-text encoding and provides no confidentiality.

Why does Base64 usually increase size?+

Every 3 input bytes become 4 Base64 characters, so large payloads grow by about 33.3% before any protocol-specific wrapping.

What does = mean in Base64?+

It is padding used to complete the final four-character encoding quantum when the input byte length is not a multiple of three.

Is Base64 padding always required?+

RFC 4648 requires appropriate padding in the general case unless the specification using Base64 explicitly states that padding is unnecessary or omitted.

What is the difference between Base64 and Base64URL?+

Base64URL replaces + with - and / with _ so the alphabet is safer in URLs and filenames. Some Base64URL-based protocols also omit padding.

Can I decode Base64 without padding?+

Only when the surrounding format permits unpadded Base64 or the decoder deliberately supports it. This page makes that behavior an explicit option.

Why does strict mode reject spaces or line breaks?+

Generic RFC 4648 decoding does not treat arbitrary whitespace as part of the alphabet. MIME has separate rules that permit whitespace handling, so this page exposes MIME-style handling separately.

Can decoded Base64 be binary?+

Yes. Base64 represents arbitrary bytes. The decoded result can be text, an image, a certificate, compressed data or any other binary content.

Why does the tool sometimes show hexadecimal after decoding?+

If the decoded bytes are not safely displayable UTF-8 text, hexadecimal preserves an exact readable representation without corrupting arbitrary binary bytes in HTML.

Is Base64 the same as ASCII?+

No. Base64 is an encoding that represents bytes using a limited ASCII-compatible character alphabet. ASCII is a character encoding.

Does Base64 define UTF-8?+

No. Text must first become bytes using a character encoding such as UTF-8; Base64 then represents those bytes.

Why is Base64 used in HTTP Basic authentication?+

HTTP Basic Base64-encodes the user-id/password byte sequence for transport syntax. RFC 7617 warns that this does not secure the credentials, so secure transport such as TLS is needed.

Is Base64 used in email?+

Yes. MIME defines Base64 as a content-transfer encoding and includes line-length and whitespace-handling rules for email transport.

What does strict Base64 decoding validate?+

This page validates the chosen alphabet, length, padding position, expected padding and canonical re-encoding before accepting the decoded bytes.

Can I paste passwords or API keys here?+

You should avoid submitting secrets to public online conversion tools. This page processes the submitted value on the web server.

What standard defines Base64?+

RFC 4648 defines the commonly used Base64 and Base64URL alphabets and their general encoding rules. MIME Base64 also has context-specific rules in RFC 2045.