๐Ÿ”ข Number Systems Interactive Guide

EEE120 - Module 2: Binary, Decimal, Octal, Hexadecimal

๐Ÿ”„ Universal Number System Converter

Convert between Binary, Decimal, Octal, and Hexadecimal instantly!

Binary (Base-2)

-

Decimal (Base-10)

-

Octal (Base-8)

-

Hexadecimal (Base-16)

-

๐ŸŽฏ Quick Reference

Binary (Base-2)

Uses: 0, 1

Example: 1011โ‚‚ = 11โ‚โ‚€

Decimal (Base-10)

Uses: 0-9

Example: 29โ‚โ‚€

Octal (Base-8)

Uses: 0-7

Example: 35โ‚ˆ = 29โ‚โ‚€

Hexadecimal (Base-16)

Uses: 0-9, A-F

Example: 1Dโ‚โ‚† = 29โ‚โ‚€

โž• Binary Addition

โž– Binary Subtraction (Two's Complement)

๐Ÿ”„ Two's Complement Calculator

๐Ÿ“Š 4-bit Signed Binary Converter

Binary Circle (4-bit)

๐Ÿ“š Number System Fundamentals

What is a Number System?

A number system is a way to represent numbers using a specific set of symbols (digits). Different systems use different bases.

Decimal (Base-10)

MOD-10 system

Digits: 0 through 9

Most common for everyday use

Binary (Base-2)

MOD-2 system

Digits: 0 and 1

Foundation of digital electronics

Octal (Base-8)

MOD-8 system

Digits: 0 through 7

Groups 3 binary digits

Hexadecimal (Base-16)

MOD-16 system

Digits: 0-9, A-F

Groups 4 binary digits

Conversion Methods

Binary to Decimal

Multiply each bit by 2 raised to its position power, then sum.

Example: 1011โ‚‚
= 1ร—2ยณ + 0ร—2ยฒ + 1ร—2ยน + 1ร—2โฐ
= 8 + 0 + 2 + 1
= 11โ‚โ‚€

Decimal to Binary

Divide by 2 repeatedly, recording remainders bottom-to-top.

Example: 29โ‚โ‚€
29 รท 2 = 14 remainder 1
14 รท 2 = 7 remainder 0
7 รท 2 = 3 remainder 1
3 รท 2 = 1 remainder 1
1 รท 2 = 0 remainder 1
Result: 11101โ‚‚

Binary to Octal

Group binary digits in sets of 3 (from right), convert each group.

Example: 11101โ‚‚
011 101 (grouped)
3 5 (octal)
Result: 35โ‚ˆ

Binary to Hexadecimal

Group binary digits in sets of 4 (from right), convert each group.

Example: 11101โ‚‚
0001 1101 (grouped)
1 D (hex)
Result: 1Dโ‚โ‚†

๐Ÿ”ข Signed Binary Numbers

Two's Complement

Two's complement is the most common method for representing signed numbers in binary.

How to get Two's Complement:

  1. Step 1: Invert all bits (One's Complement)
  2. Step 2: Add 1 to the result
Example: Find two's complement of 0011โ‚‚ (+3)
Step 1: Invert bits โ†’ 1100
Step 2: Add 1 โ†’ 1100 + 0001 = 1101โ‚‚ (-3)

Signed vs Unsigned Binary

4-bit Binary Unsigned Signed (Two's Complement)
000000
00011+1
00102+2
00113+3
01117+7
10008-8
10019-7
111115-1

Unsigned Range

For n bits: 0 to 2โฟ-1

4-bit: 0 to 15

Leading bit can be 0 or 1

Signed Range

For n bits: -2โฟโปยน to 2โฟโปยน-1

4-bit: -8 to +7

MSB (sign bit): 0=positive, 1=negative

Overflow Detection

Overflow occurs when the result exceeds the representable range. In signed arithmetic, overflow happens when CMSB โ‰  Cout

๐Ÿ”ง Half Adder

A half adder adds two single bits and produces a sum and carry output.

Truth Table:

A B Sum Carry
0000
0110
1010
1101
Logic Equations:
Sum = A โŠ• B (XOR)
Carry = A ยท B (AND)

๐Ÿ”ฉ Full Adder

A full adder adds three bits: two inputs plus a carry-in, producing sum and carry-out.

Truth Table:

A B Cin Sum Cout
00000
00110
01010
01101
10010
10101
11001
11111
Logic Equations:
Sum = A โŠ• B โŠ• Cin
Cout = AB + ACin + BCin

๐Ÿ—๏ธ Multi-bit Adder (Ripple Carry)

Multiple full adders chained together, with carry output of one feeding carry input of next.

4-bit Ripple Carry Adder Example:

Adding 1011โ‚‚ + 0110โ‚‚

Position: 3 2 1 0
A: 1 0 1 1
B: + 0 1 1 0
Carry: 1 0 1 1 0
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Sum: 1 0 0 0 1

๐Ÿ“ Practice Problems

Problem 1: Binary to Decimal

Convert 110110โ‚‚ to decimal.

Problem 2: Decimal to Binary

Convert 77โ‚โ‚€ to binary.

Problem 3: Binary Addition

Add 1101โ‚‚ + 1011โ‚‚

Problem 4: Two's Complement

Find the two's complement of 01010โ‚‚

Problem 5: Hexadecimal to Decimal

Convert 2A9โ‚โ‚† to decimal.

๐ŸŽฒ Random Practice Generator