Binary Calculator

Binary Converter | Decimal to Binary, Hex, Octal & ASCII Conversion

Binary Number Converter

Convert between decimal, binary, hexadecimal, octal, and ASCII representations

Number System Converter

Decimal
Binary
Hexadecimal
Octal
ASCII

Enter a positive integer (0-9)

Binary Bit Representation

Each box represents one bit (binary digit). Active bits (1) are highlighted in green.

Conversion Results

Decimal
42
Binary
101010
Hexadecimal
2A
Octal
52

ASCII Character

A
Character Representation

ASCII Code: 65 (Decimal)

Unicode: U+0041

Conversion Steps

Decimal to Binary
42 ÷ 2 = 21 remainder 0
21 ÷ 2 = 10 remainder 1
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Reading remainders from bottom to top: 101010

Common Number Conversions

Reference table for common decimal, binary, hexadecimal, octal, and ASCII values.

Decimal Binary Hexadecimal Octal ASCII

Understanding Number Systems

Number systems are different ways to represent numeric values. The most common systems in computing are decimal (base-10), binary (base-2), hexadecimal (base-16), and octal (base-8). Each system has specific applications in computer science, digital electronics, and programming.

Decimal System (Base-10)

The decimal system uses ten digits (0-9) and is the standard system for everyday use. Each digit’s position represents a power of 10. This is the most familiar number system to humans.

Binary System (Base-2)

The binary system uses only two digits (0 and 1), representing the on/off states in digital electronics. Computers process all information as binary data. Each binary digit is called a “bit”.

Hexadecimal (Base-16)

Hexadecimal uses sixteen symbols: 0-9 and A-F. It’s commonly used in programming and debugging because it compactly represents binary values (one hex digit = 4 binary digits).

Octal System (Base-8)

The octal system uses eight digits (0-7). It was historically important in computing but has been largely replaced by hexadecimal. It’s still used in some Unix file permission systems.

Binary Conversion Methods

Decimal to Binary Conversion (Division Method)

To convert decimal to binary:

  1. Divide the decimal number by 2
  2. Record the remainder (0 or 1)
  3. Divide the quotient by 2
  4. Repeat until the quotient is 0
  5. Read the remainders in reverse order to get the binary equivalent
Example: Convert 42 to binary
42 ÷ 2 = 21 remainder 0
21 ÷ 2 = 10 remainder 1
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Binary: 101010 (read remainders from bottom to top)

Binary to Decimal Conversion (Positional Notation)

To convert binary to decimal, multiply each bit by its corresponding power of 2 and sum the results:

Binary: 101010
= (1×2⁵) + (0×2⁴) + (1×2³) + (0×2²) + (1×2¹) + (0×2⁰)
= (1×32) + (0×16) + (1×8) + (0×4) + (1×2) + (0×1)
= 32 + 0 + 8 + 0 + 2 + 0
= 42

Hexadecimal to Binary Conversion

Each hexadecimal digit converts directly to 4 binary bits:

Hex: 2A
2 = 0010 (binary)
A = 1010 (binary)
Combined: 0010 1010 = 101010 (after removing leading zeros)

ASCII Encoding System

ASCII (American Standard Code for Information Interchange) is a character encoding standard that represents text in computers. It assigns unique numeric codes to 128 characters including:

  • Control characters (0-31): Non-printable codes for device control
  • Printable characters (32-126): Letters, numbers, punctuation, and symbols
  • Extended ASCII (128-255): Additional characters for specific languages

Modern systems typically use Unicode (UTF-8) which is backward compatible with ASCII for the first 128 characters.

Applications in Computing

  • Binary: Machine code, processor instructions, digital circuit design
  • Hexadecimal: Memory addresses, color codes in web design (#RRGGBB), debugging
  • Octal: Unix/Linux file permissions (chmod command)
  • ASCII/Unicode: Text representation, string manipulation, internationalization

Bitwise Operations

Binary numbers enable bitwise operations that are fundamental to computer programming:

  • AND (&): Returns 1 only if both bits are 1
  • OR (|): Returns 1 if at least one bit is 1
  • XOR (^): Returns 1 if bits are different
  • NOT (~): Inverts all bits (0 becomes 1, 1 becomes 0)
  • Left Shift (<<): Shifts bits left, equivalent to multiplying by 2
  • Right Shift (>>): Shifts bits right, equivalent to dividing by 2

Historical Context

The binary system was formally described by Gottfried Wilhelm Leibniz in the 17th century, though binary-like systems were used in ancient cultures. The modern application in computing began with Claude Shannon’s 1937 thesis demonstrating how Boolean algebra could be implemented with electrical switches, forming the theoretical foundation for digital circuit design.