DT
Dr. Teach Tech Technology designed for thinking
Bit HarborBinary representation + data encoding
Browser autosave: Ready
Teacher Guide

Dr. Teach Tech / interactive computer science

Bit Harbor

Learn how computers represent information with bits.

Build binary numbers, see what happens when values exceed a fixed range, explore how context changes the meaning of stored bits, and apply binary encodings to text, sound, images, and a final routing game.

Local student workspace

Bit Harbor

Used only as a local identifier so this browser can find your saved Bit Harbor work. Active engagement time pauses when this tab is hidden.

Teacher Guide

DR TEACH TECH • INTERACTIVE CS

Bit Harbor

Learn how computers count, one bit at a time.

StudentNot signed in
Active time00:00
Score0

LEVEL 1 • WHY BINARY?

Computers only need two states.

A bit can be off or on. We write those two states as 0 and 1. Binary place values grow using powers of 2.

Decimal places grow 1, 10, 100, 1000...
Binary places grow 1, 2, 4, 8, 16, 32...

Binary Basics Practice 0/5

The decimal number 13

00001101

8 + 4 + 1 = 13

LEVEL 2 • BUILD A NUMBER

Bit Flip Board

Click a bit to turn its place value on or off. Complete five randomly selected targets to finish this activity.

Binary00000000
Decimal0
Active valuesnone

Challenge 0/5

Build decimal 19 in binary.

LEVEL 3 • COUNTING, LIMITS, AND ERRORS

Binary Odometer

Why study a binary odometer?

An odometer makes a computer's limits visible. A fixed number of bits can represent only a fixed set of patterns. With 8 bits, there are 256 patterns, but the largest unsigned value is 255 because zero is one of the values.

00000000 = 0
11111111 = 255
256 total patterns because the count includes zero.

What does out of bounds mean?

Software often expects data to stay inside an allowed range. When a value goes outside that range, the result depends on the language and system. It may report an error, stop, wrap around, clamp the value, or continue with incorrect data.

Overflow means a numeric result is too large for the representation. Underflow can mean a value is too small to represent, especially for floating-point values. Index out of bounds means code requested a list or array position that does not exist. Range or conversion errors occur when a value cannot fit into the destination type.

Why programmers care: Computers do not automatically know when a value is unreasonable. Programs need rules for valid ranges and what to do when data does not fit.

Real-world examples

Four Important Types of Programming Errors

When programmers talk about an error, they do not always mean the same thing. It helps to separate errors into three common categories.

Syntax Error

A syntax error happens when code does not follow the rules of the programming language. The program usually cannot start until the mistake is fixed.

Example: missing a parenthesis, brace, quotation mark, or semicolon.

Runtime Error

A runtime error happens after the program starts running. Something occurs that the program cannot safely complete.

Example: trying to use an array position that does not exist, dividing by zero in some languages, or converting a value that is outside the allowed range.

Logic Error

A logic error means the program runs, but the result is wrong because the instructions or assumptions are incorrect.

Example: using the wrong formula, checking the wrong condition, or interpreting data using the wrong units.

Overflow Error

An overflow error happens when a number becomes too large, or sometimes too small, to fit in the number of bits or data type available.

Example: an unsigned 8-bit value can store 0 through 255. Trying to go one higher than 255 exceeds that range.

8-bit example: An unsigned 8-bit number has 256 possible patterns, from 0 through 255. If an odometer is already at 11111111 (255) and you add 1, there is no ninth bit available in an 8-bit value. That is an overflow. Depending on the system, the program may report an error or the value may wrap back to 00000000 (0).
How this connects to the Binary Odometer:
  • Overflow error happens when a value does not fit in the available range. Some systems stop with a runtime error, while others wrap or truncate the value, which can create a logic error if the program does not handle it correctly.
  • Index out of bounds is usually a runtime error because the program tries to access a position outside the valid range.
  • Range or conversion errors can be runtime errors when a value cannot fit in the destination type.
  • Incorrect units or assumptions are often logic errors because the program may run normally while producing the wrong result.

Patriot system, 1991

A small timing precision error accumulated after many hours of operation and affected tracking of an incoming Scud missile. This was a precision problem, not a simple 8-bit overflow, but it shows how small representation errors can become serious.

Ariane 5 Flight 501, 1996

A 64-bit floating-point value was converted to a 16-bit signed integer. The value was too large to fit, causing an exception that contributed to loss of guidance.

Mars Climate Orbiter, 1999

One part of the mission used English units while another expected metric units. This was not overflow, but it shows how computers can process numbers correctly while humans disagree about their meaning.

Historical examples summarized from U.S. GAO, ESA, and NASA/JPL investigations.

Now use the odometer to see a representational limit yourself. Trigger rollover and complete five randomly selected questions.

Base 10 Odometer

Binary Odometer

Base 100
Binary00000000
Binary
Hexadecimal00
Largest unsigned value255
Total patterns256
Next value after maxOverflow → 0
Slow Fast

Watch the Odometer

Press Start. In 8-bit mode the odometer begins at 0 and counts upward: 0, 1, 2, 3... Watch how the same value is represented in Base 10 and Binary.

Example: In 8-bit mode, decimal 3 appears as 0 0 3, while binary appears as 0 0 0 0 0 0 1 1. Each square is one place in that number system.
Overflow, out of bounds!

The fixed-width value has reached its largest possible number. Adding 1 requires another bit, so this teaching odometer rolls back to 0. For 8 bits, 255 is the largest unsigned value, while 256 is the number of possible patterns because zero counts.

Odometer Practice 0/5

LEVEL 5 • THE BITS NEED MEANING

Context Matters

The same bits can mean different things

Binary stores patterns of 0s and 1s. A bit pattern does not contain a built-in label saying, “I am a positive number,” “I am a negative number,” “I am text,” or “I am a color.” Software needs rules that explain how the bits should be interpreted.

Those rules can come from a data type, CPU instruction, file format, database field, or protocol. Sometimes metadata is stored with the data. Other times the program already knows the expected format. Bits plus context create meaning.

Signed and unsigned integers

An unsigned 8-bit integer uses all eight bit positions for values from 0 through 255.

A common signed representation is two's complement. With 8 bits, the leftmost position has a weight of -128. The remaining weights are 64, 32, 16, 8, 4, 2, and 1.

1
1
1
1
1
1
1
1
-128
64
32
16
8
4
2
1
11111111 unsigned = 255
11111111 signed 8-bit two's complement = -1

A leftmost bit of 0 means a two's-complement value is nonnegative. A leftmost bit of 1 means it is negative. The leftmost bit participates in the value. It is not simply a separate “negative switch.”

Try one bit pattern

11111111
Unsigned 8-bit integer255
Signed two's complement-1
Grayscale intensity255, white

Does the computer need extra binary data every time?

Not always. Sometimes metadata identifies a format. Often the context comes from software itself. A variable's data type, a file format, or an instruction tells the computer how to interpret stored bits.

Stored data does not explain itself. The meaning comes from an agreed encoding or interpretation.

Context Practice 0/5

LEVEL 6 • BINARY REPRESENTS MANY KINDS OF DATA

Binary in Media

The same 0s and 1s can represent very different information when different encoding rules are used. Complete all three activities.

1. Text with ASCII

ASCII is a code that assigns a number to each character. You are not expected to memorize the table. Use the reference below just like a programmer would use documentation.

Use the reference to decode this byte into a capital letter:

01000001
CharacterDecimal8-bit Binary
A6501000001
B6601000010
C6701000011
D6801000100
E6901000101
F7001000110
G7101000111
H7201001000
I7301001001
J7401001010
K7501001011
L7601001100
M7701001101
N7801001110
O7901001111
P8001010000
Q8101010001
R8201010010
S8301010011
T8401010100
U8501010101
V8601010110
W8701010111
X8801011000
Y8901011001
Z9001011010

Real ASCII includes many more characters. This shortened table keeps the activity focused on uppercase letters.

2. Music as Beats

Digital audio is often sampled as numbers. For this simpler activity, use a beat encoding: 1 = sound, 0 = rest.

Build this eight-beat pattern: 10110010.

Press Play Pattern to hear the current 8-beat sequence.

3. Images with Pixels

A simple black-and-white image can use one bit per pixel. Here, 0 = white and 1 = black.

Match: 1010 0101 1010 0101


RGB color uses separate numeric values for red, green, and blue.

R128
Red decimal128
Red binary10000000
Red hex80
G64
Green decimal64
Green binary01000000
Green hex40
B192
Blue decimal192
Blue binary11000000
Blue hexC0
Combined web color#8040C0
Quick hexadecimal reference: Hexadecimal is base 16. It uses 0 through 9 and A through F. One hexadecimal digit represents exactly 4 binary bits, so two hex digits represent one 8-bit RGB channel. For example, 11111111 in binary is FF in hexadecimal, which is decimal 255. Web colors combine the three channels, so #FF0000 means full red, no green, and no blue.

Each 8-bit RGB channel has 256 possible values, from 0 through 255. The same channel can be written in decimal, binary, or hexadecimal.

Student Progress Record

LEVEL 4 • ORIGINAL GAME

Packet Harbor

Before the Game: What Is a Packet?

When computers communicate, they often break information into smaller pieces called packets. Think of a packet as a small digital envelope carrying part of some information.

Packets travel between devices and need addressing information so the network knows where they should go. You do not need to know networking yet for this activity.

Packet Harbor uses a simplified pretend network. Each dock is a destination. Each dock has a decimal number, and that same number can also be written in binary.

Example: Dock 13 is decimal 13. Its binary address is 00001101 because 8 + 4 + 1 = 13.

Your job is only to practice binary conversion. The packet theme gives the numbers a purpose, but these dock addresses are not real Internet addresses.

Complete five randomly selected Packet Harbor problems. Some ask you to build a binary address. Others ask you to decode binary into decimal.

BUILD ADDRESSDock 27Set the bits to create decimal 27.
Dock A
Dock B
Dock C
Correct0/5
Streak0
Lives♥ ♥ ♥

Current value: 0

Harbor hint

Start with the largest place value that fits.

Student Progress Record

Completion requires all four activities. Active time counts while this tab is visible.