Encoding & Decoding

Binary Converter: Convert Text and Numbers to Binary Online

Convert text strings and decimal numbers to binary (base-2) representation and back. Includes ASCII, UTF-8, and multi-base number conversion.

Published January 15, 2025Updated June 1, 20255 min read

Try the free online tool

Runs entirely in your browser — no signup, no uploads.

Open Tool

Binary is the fundamental language of computers. Every piece of data stored or processed by a computer is ultimately represented as a sequence of bits — 0s and 1s. Understanding binary and being able to convert between binary, decimal, hexadecimal, and text is a core skill in computer science, embedded systems development, networking, and low-level programming.

Text-to-binary conversion works by taking each character in the string, finding its numeric code point (using ASCII or UTF-8), and expressing that number in base-2. The letter A has the ASCII code 65, which in binary is 01000001. A complete text string becomes a series of 8-bit groups (for ASCII) or multi-byte sequences (for Unicode UTF-8).

This tool converts text to binary and back, converts decimal and hexadecimal numbers to binary, and displays the result with optional spacing for readability. Whether you are studying computer science fundamentals, debugging a binary protocol, or working on bit manipulation algorithms, this tool provides instant, accurate conversions.

How Binary Representation Works

Binary (base-2) is a positional number system that uses only two digits: 0 and 1. Each digit position represents a power of 2, starting from 2^0 (1) at the rightmost position. For example, the binary number 01000001 equals 0*128 + 1*64 + 0*32 + 0*16 + 0*8 + 0*4 + 0*2 + 1*1 = 65 in decimal.

Text is converted to binary by first mapping each character to its numeric code point. ASCII assigns code points 0-127 to English letters, digits, punctuation, and control characters. Unicode extends this to over one million code points for all human writing systems. UTF-8 is the encoding that converts Unicode code points to byte sequences; ASCII characters have the same single-byte value in UTF-8.

Each byte (8 bits) in the binary representation carries a value from 0 to 255. For text display, binary groups are typically shown as 8-bit octets separated by spaces. For number representation, leading zeros may be omitted (65 is shown as 1000001 rather than 01000001).

How to Use This Tool

Converting between text, numbers, and binary is fast with this tool.

  1. 1

    Choose the conversion mode

    Select Text to Binary (converts each character using ASCII/UTF-8), Binary to Text (reads 8-bit groups as characters), Number to Binary (converts a decimal or hex number), or Binary to Number.

  2. 2

    Enter your input

    Type or paste the text string, binary sequence, decimal number, or hexadecimal number into the input field.

  3. 3

    Configure display options

    Choose whether to show binary groups separated by spaces for readability, or as a continuous string for compact output.

  4. 4

    Click Convert

    The tool performs the conversion and displays the result instantly.

  5. 5

    Copy the output

    Use the Copy button to copy the binary string or decoded text to your clipboard.

Common Use Cases

Binary conversion is relevant across many areas of computing.

  • Learning and teaching binary number representation and ASCII encoding in computer science courses.
  • Debugging binary file formats, network packets, or serial protocol data.
  • Converting permission bits (like Unix file permissions 755) between octal, binary, and decimal.
  • Understanding bit manipulation operations by visualising the binary representation of values.
  • Converting IP addresses and subnet masks to binary to understand CIDR notation and subnetting.
  • Encoding or decoding binary-coded decimal (BCD) values used in embedded systems and some hardware protocols.

Tips and Best Practices

  • When reading binary text, ensure the binary string length is a multiple of 8; if not, it may be padded or truncated, leading to incorrect character decoding.
  • Non-ASCII Unicode characters require more than one byte per character in UTF-8; their binary representation is more than 8 bits and cannot be decoded as single-byte ASCII.
  • Use hexadecimal as an intermediate representation for readability: 8 binary digits become 2 hex digits, which is much easier to read and compare (FF = 11111111).
  • For IP subnet calculations, convert both the IP address and subnet mask to binary, then AND them to find the network address.
  • When working with bit flags, express your bitmask constants in binary using the 0b prefix in modern languages (Python, JavaScript, Java) to make the bit positions immediately obvious in code.

Number Bases: Binary, Octal, Decimal, and Hexadecimal

Computers use four number bases in different contexts. Decimal (base-10) is human-readable and used for most user-facing values. Binary (base-2) is the native machine representation; all arithmetic and logic in a CPU operates on binary values. Octal (base-8) was commonly used for Unix file permissions and early assembly programming because three bits map to one octal digit. Hexadecimal (base-16) is the most practical base for developers: four bits map to one hex digit, making it compact and aligned with byte boundaries.

Converting between bases: binary to hexadecimal is done four bits at a time (0000=0, 0001=1, ... 1111=F). Decimal to binary uses repeated division by 2, recording the remainders from bottom to top. Binary to decimal sums the positional values of all 1 bits. Most calculators and programming environments provide built-in conversion functions, but understanding the underlying process is valuable for debugging and low-level work.

Frequently Asked Questions

How do I convert the letter A to binary?

The letter A has the ASCII code point 65. To convert 65 to binary, repeatedly divide by 2: 65 / 2 = 32 remainder 1, 32 / 2 = 16 remainder 0, 16 / 2 = 8 remainder 0, 8 / 2 = 4 remainder 0, 4 / 2 = 2 remainder 0, 2 / 2 = 1 remainder 0, 1 / 2 = 0 remainder 1. Reading the remainders bottom to top gives 1000001, or 01000001 as an 8-bit byte.

What is the difference between a bit and a byte?

A bit is the smallest unit of data in a computer: a single binary digit, either 0 or 1. A byte is a group of 8 bits and can represent 256 different values (0 to 255). Text characters are typically stored as one byte each for ASCII or multiple bytes for Unicode. Modern storage and bandwidth are measured in bytes (kilobytes, megabytes, gigabytes) while network speeds are measured in bits per second.

Can I convert emoji to binary with this tool?

Yes. Emoji are Unicode characters with code points above U+FFFF in most cases. In UTF-8, they are encoded as 4-byte sequences. This tool converts emoji to their UTF-8 byte representation and then to binary, resulting in four 8-bit groups per emoji character. For example, the grinning face emoji (U+1F600) becomes the bytes F0 9F 98 80 in UTF-8.

How do I convert binary to decimal by hand?

Write the binary number with the rightmost bit representing 2^0 = 1, then each bit to the left doubling: 2, 4, 8, 16, 32, 64, 128. Multiply each bit by its positional value and sum the results. For 01000001: 0+64+0+0+0+0+0+1 = 65.

What is a binary prefix like 0b in programming?

The 0b prefix (lowercase b) is used in many programming languages to write binary integer literals directly in source code. For example, 0b01000001 in Python, JavaScript (ES2015+), Java, or C# represents the decimal value 65. This makes bit manipulation code much more readable than using decimal or hexadecimal constants.

Why do computers use binary instead of decimal?

Electronic circuits naturally work in two states: on (voltage present = 1) or off (no voltage = 0). Binary maps directly to these two physical states, making it extremely reliable and easy to implement in hardware. Representing 10 states (decimal) reliably in an electronic circuit would require far more complex and error-prone hardware.

What is two's complement and how does it represent negative numbers in binary?

Two's complement is the standard way computers represent negative integers in binary. To negate a number, invert all the bits (flip 0s and 1s) and add 1. For an 8-bit signed integer, the range is -128 to 127. The leftmost bit is the sign bit: 0 for positive numbers and 1 for negative. Two's complement makes arithmetic circuits simpler because addition of positive and negative numbers uses the same circuit.

How does binary relate to hexadecimal in practice?

Hexadecimal is shorthand for binary. Four binary digits map exactly to one hex digit (0-9, A-F). Developers use hex to read binary data without the verbosity of long 0-and-1 strings. For example, the byte 11111111 in binary is FF in hex. Memory addresses, colour codes (#FF5733), and hash values are typically shown in hex for this reason.

binarynumber-systemsasciibit-manipulationcomputer-science

Ready to use this tool?

Free, instant, no account required. Runs entirely in your browser.

Open Tool

More Encoding & Decoding Guides