ASCII to Base64

Strict 7-bit ASCII to Base64 conversion, ideal for Basic Auth headers.

0 chars
0 words
0 lines
0 chars
0 words
0 lines

ASCII to Base64 Encoder and Decoder

This tool converts plain 7-bit ASCII text to Base64 and back, and it is deliberately strict about it. Every character must be in the range 0–127, the original ASCII table from 1963. If a stray é, a smart quote “ copied from a word processor, or an invisible non-breaking space slips into your input, the tool points to its exact position instead of silently producing Base64 that a legacy system might misread.

Why strict ASCII matters

Many protocols and older systems define their payload as ASCII: HTTP headers, SMTP commands, some mainframe interfaces, serial devices, and plenty of embedded firmware. For ASCII input, Base64 output is the same whether the encoder uses UTF-8 or Latin-1, so an ASCII-only string is the safest thing to hand to another program. A strict check up front saves you from debugging "invalid credentials" errors caused by a hidden Unicode character.

HTTP Basic Auth in practice

The most common use of ASCII Base64 is the Authorization header of HTTP Basic Authentication. Take user:password, encode it, and prefix the result with Basic. The sample admin:S3cret-Passw0rd! becomes:

Authorization: Basic YWRtaW46UzNjcmV0LVBhc3N3MHJkIQ==

The same header can be produced with curl -u admin:S3cret-Passw0rd! https://example.com. To read an existing header, paste the part after Basic into the Base64 to ASCII mode and you'll see the credentials in clear text, which is also a good reminder that Basic Auth must only be used over HTTPS.

Options and decoding

URL-safe output, padding, and line wrapping are available for the encoder. The decoder accepts whitespace, missing padding, the URL-safe alphabet, and data URIs, then verifies that every decoded byte is valid ASCII. For text in other languages use Text to Base64; for percent-encoding in URLs see URL Encode / Decode.

Frequently Asked Questions

Join the user name and password with a colon (for example admin:S3cret-Passw0rd!), encode that string to Base64, and send it as Authorization: Basic YWRtaW46UzNjcmV0LVBhc3N3MHJkIQ==. The header is only encoded, not encrypted, so always use HTTPS.

ASCII only covers code points 0 to 127: English letters, digits, punctuation, and control characters. Accented letters, curly quotes, non-breaking spaces, and emoji are outside that range. Replace them, or use Text to Base64, which encodes any Unicode text as UTF-8.

The decoded data contains a byte above 127, so the original was not pure ASCII. It is most likely UTF-8 text with special characters or binary data such as an image. Decode it with Text to Base64 or inspect the raw bytes with Hex to Base64.