TOP

Free browser-based binary converter

ASCII to Binary Converter

Convert ASCII text into fixed 8-bit binary groups instantly. Use UTF-8 Bytes when your text includes accents, non-Latin scripts, symbols, or emoji.

No signup Free online conversion

Interactive tool

Convert ASCII characters to binary

Ready

Output layout

ASCII mode emits one 8-bit group per character and marks unsupported characters instead of guessing an encoding.

Conversion guide

How to Convert ASCII to Binary

Each ASCII character has a decimal value from 0 to 127. To convert a character to binary, look up its ASCII value, write that number in base 2, and pad the result to eight digits. The capital letter A is decimal 65, so its 8-bit form is 01000001.

The default tool repeats this process for every character, including spaces and control characters. For example, Hi becomes 01001000 01101001. Space-separated output is easiest to inspect because every 8-bit group maps to one ASCII character.

CharacterASCII decimal8-bit binary
A6501000001
B6601000010
a9701100001
04800110000
Space3200100000

ASCII to Binary in JavaScript

JavaScript can read each ASCII character with charCodeAt, convert the decimal value with toString(2), and use padStart(8, "0") to produce a full byte. Validate values above 127 before calling the result ASCII.

function asciiToBinary(text) {
  return Array.from(text, (character) => {
    const value = character.charCodeAt(0);
    if (value > 127) throw new Error("Non-ASCII character");
    return value.toString(2).padStart(8, "0");
  }).join(" ");
}

asciiToBinary("Hi");
// 01001000 01101001

ASCII to Binary in Python

Python's ord function returns the numeric value of a character, and format(value, "08b") writes that value as an 8-bit binary string. Checking that every value is below 128 keeps the conversion strictly ASCII.

def ascii_to_binary(text):
    if any(ord(char) > 127 for char in text):
        raise ValueError("Non-ASCII character")
    return " ".join(format(ord(char), "08b") for char in text)

print(ascii_to_binary("Hi"))
# 01001000 01101001

7-bit ASCII vs 8-bit Binary

Standard ASCII needs only seven bits because its highest value is 127, or 1111111. Computers normally store data in 8-bit bytes, so converters add a leading zero. That is why ASCII A is often shown as 01000001 instead of 1000001.

The leading zero does not change the value. It creates a consistent byte-sized result that is easier to group, transmit, compare, and convert back to text.

One ASCII character equals one 8-bit group here.

This rule is reliable only for standard ASCII. Characters outside U+007F need a named encoding such as UTF-8.

ASCII Binary vs UTF-8 Binary

ASCII is a subset of UTF-8, so English letters, digits, punctuation, and control characters have the same single-byte values in both. Non-ASCII characters are different. The character é is not standard ASCII; in UTF-8 it uses two bytes: 11000011 10101001.

Writing é as 11101001 assumes a single-byte encoding such as Latin-1, not ASCII or UTF-8. Use the UTF-8 Bytes mode when your input includes accents, Chinese, Japanese, emoji, or any other character above U+007F.

Advertisement

Sponsored link