Home
Login

Color

Indigo
Red
Green
Teal
Blue
Purple
Rose

Mode

Light
বাং

Counting with just two digits: the binary system in motion

Binary is ordinary counting with only two digits, 0 and 1. Each column is worth twice the column on its right (1, 2, 4, 8, 16 and so on), so any number is just a list of switches saying which place values to add up. Flip the eight bits in the simulation and watch the decimal, octal and hexadecimal forms follow.

Bit 1 (on)Bit 0 (off)Carry
Speed

Controls

What to watch

45

Flip the bits (biggest place value on the left)

Readings

Decimal
45
Binary
101101₂
Octal
55₈
Hexadecimal
2D₁₆
Bits that are 1
4
Bits needed
6

How to use this simulation

  1. Look at the eight columns labelled 2⁷ down to 2⁰. Under each sits a box that is 1 (on, coloured) or 0 (off). Each box is a switch.
  2. Press the small bit buttons under the controls, or drag the “Decimal number” slider. The boxes change, and the readings show the same number in decimal, binary, octal and hexadecimal.
  3. Stay on “Add place values”. Play and the columns light up from the left; every column that is on contributes its place value, and the green line adds them.
  4. Switch to “Divide by 2”. The number is halved again and again, and each remainder drops into a box on the right. Read the boxes from the bottom up to get the binary number.
  5. Try “Octal” and “Hex”. The bits are cut into coloured groups of three or four from the right, and each group becomes one digit. Notice that no arithmetic on the whole number is needed.
  6. Open “Binary addition” and set the second number. Columns are added from the right; a red 1 above a column is the carry. The line under the stage spells out each column.

Why computers count in twos

Inside a computer, everything is a switch. A transistor is either letting current through or it is not, a spot on a disc is either shiny or dull, a wire is either high voltage or low. Two states are easy to build, cheap to copy and hard to confuse. Ten states, one for each of our usual digits, would need ten different voltage levels and a circuit that could tell them apart reliably, even on a hot day with a bit of noise on the line.

So a computer writes numbers using only two symbols, 0 and 1, each called a bit (short for binary digit). It is the same counting you already know, just with a smaller alphabet. Once you see the pattern, converting between binary and decimal becomes a bit of routine arithmetic rather than a mystery.

Place value: the idea behind every number system

Take the decimal number 3,507. The 7 is worth seven ones, the 0 is worth no tens, the 5 is worth five hundreds and the 3 is worth three thousands. Each column is ten times the one on its right. The ten is the base, and it is why we call decimal base 10.

Binary uses exactly the same idea with a base of 2. Starting from the right, the columns are worth 1, 2, 4, 8, 16, 32, 64, 128 and so on, doubling each time. Because a digit can only be 0 or 1, a column is either counted once or not at all. There is no “three of this column”. That is the whole system.

ColumnPlace value
2⁰1
2¹2
2²4
2³8
2⁴16
2⁵32
2⁶64
2⁷128
2⁸256
2⁹512
2¹⁰1,024

Binary to decimal: add up the switched-on place values

Here is 214 written in binary: 11010110. Put it under the place-value columns and ask one question per column: is the switch on? If it is, take that column’s value, otherwise take zero. Then add.

The columns that are on are 128 + 64 + 16 + 4 + 2, which is 5 of the eight. Their sum is 214. Nothing else is needed. This is the “Add place values” view in the simulation.

11010110₂ = 128 + 64 + 16 + 4 + 2 = 214Add only the columns holding 1.

ColumnPlace valueBitContributes
2⁷1281128
2⁶64164
2⁵3200
2⁴16116
2³800
2²414
2¹212
2⁰100

Decimal to binary: halve it again and again

To go the other way, ask a different question: is the number odd or even? Divide by 2 and write down the remainder, which is 1 for odd and 0 for even. Then do the same with the quotient. Keep going until the quotient reaches 0. For 45 that takes 6 divisions.

The first remainder is the ones column (1) and the last one is the biggest column (1). So you read the remainders from the bottom to the top, which gives 101101. It is the reverse of the order in which you found them, and it is the single most common slip in this chapter.

45 = 101101₂Check by adding place values: 32 + 8 + 4 + 1 = 45.

DivideQuotientRemainder
45 ÷ 2221
22 ÷ 2110
11 ÷ 251
5 ÷ 221
2 ÷ 210
1 ÷ 201

The first sixteen numbers in four bases

Keep this table in your head and half of the chapter is free. Four bits cover exactly 0 to 15, which is why one hexadecimal digit stands for four bits. Past 9, hexadecimal runs out of digits and borrows the letters A to F, so A is ten, B is eleven and F is fifteen.

DecimalBinaryOctalHex
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F

Octal: bits in groups of three

Binary numbers get long quickly. Octal is the shorthand that compresses them without any calculation, because eight is 2³ and so three bits make exactly one octal digit. Split the bits into threes starting from the right (pad the left with zeros if needed) and read each group on its own.

For 214 = 11010110, add a zero to the front and cut: 011 010 110. Those groups are worth the following digits, so 214 in octal is 326₈.

Group of three bitsOctal digit
0113
0102
1106

Hexadecimal: bits in groups of four

Hexadecimal is base 16, and sixteen is 2⁴, so every four bits make one hex digit. It is the favourite of programmers because one byte (eight bits) is always exactly two hex digits.

For 214, cut 11010110 into fours: 1101 0110. The left group is 13, which is written D, and the right group gives the other digit. Together that is D6₁₆.

Group of four bitsHex digitValue
1101D13
011066

Binary addition with carries

Binary addition has only four facts to remember: 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1 and 1 + 1 = 10 (that is, 0 and carry 1). It is the school column addition you already know, except that a column overflows as soon as it reaches 2 instead of 10.

Work from the right. Add the two bits and any carry in. If the total is 0 or 1, write it down. If it is 2, write 0 and carry 1 to the next column. If it is 3 (1 + 1 + 1 carry), write 1 and carry 1. Adding 101101 and 11011 (that is 45 + 27) needs 6 carries and gives 1001000, which is 72.

ColumnBit + bit + carry inTotalWriteCarry out
11 + 1 + 0201
20 + 1 + 1201
31 + 0 + 1201
41 + 1 + 1311
50 + 1 + 1201
61 + 0 + 1201
70 + 0 + 1110

How many bits do I need?

With n bits you can write 2ⁿ different patterns, so the numbers 0 to 2ⁿ − 1. Add one more bit and the count doubles. This is why eight bits (a byte) give 256 values, and why 32-bit and 64-bit computers talk about memory in such huge numbers.

The bits needed for a number N is the smallest n with 2ⁿ greater than N. A quick way is to find the power of two just above it.

BitsPatterns (2ⁿ)Largest number (2ⁿ − 1)
121
41615
8256255
101,0241,023
1665,53665,535
324,294,967,2964,294,967,295

Try it in the simulation

Five quick experiments. Each takes under a minute and each one makes the rules stick.

  • Switch on only the rightmost box: the number is 1. Switch on only the next: 2. Every single box is just a power of two.
  • Turn all eight boxes on. You get the biggest one-byte number. Press the rightmost button to turn the 1 off and watch the number drop by exactly 1.
  • Pick any number, run “Divide by 2”, then run “Add place values” on the same number. Two completely different routes, one answer.
  • In “Hex”, find a number whose left group is 1111. Its hex digit is F, the highest single digit.
  • In “Binary addition”, set both numbers to 127. Count the carries: the sum needs a ninth column, which is why this simulation stops at 127 for the second number.

Solved problems

Six common questions in the chapter. Every number below is computed with the same code as the simulation.

Problem 1: convert 156 to binary

Divide by 2 repeatedly and keep the remainders.

Reading the remainders from the bottom up gives 10011100₂. So 156 = 10011100₂.

DivideQuotientRemainder
156 ÷ 2780
78 ÷ 2390
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201

Problem 2: convert 10110101 to decimal

Write the place values under the bits and keep the ones that sit under a 1: 128 + 32 + 16 + 4 + 1.

The total is 181. So 10110101₂ = 181.

Problem 3: binary to octal and hexadecimal

Convert 11101011₂ (which is 235).

For octal, pad the left with a zero and cut into threes: 011 101 011, which reads 353₈.

For hex, cut into fours: 1110 1011. The left group is 14, which is the letter E, so the answer is EB₁₆.

Problem 4: add 1011 and 110

In decimal that is 11 + 6 = 17. Do it in binary: add from the right, carry whenever a column reaches 2.

There are 3 carries and the answer is 10001₂, matching 17.

Problem 5: how many bits to store 1000?

2⁹ = 512, which is too small, and 2¹⁰ = 1,024, which is enough. So 1,000 needs 10 bits.

The largest number 10 bits can hold is 1,023.

Problem 6: where do you meet this outside the exam?

An IP address like 192.168.1.1 is four numbers of one byte each. 192 is 11000000 and 168 is 10101000 in binary.

The capital letter A is stored with the code 65, which is 01000001₂ or 41₁₆ in hex.

Mistakes to avoid

These cost marks again and again.

  • Reading the remainders from top to bottom. They must be read bottom to top.
  • Stopping the division at 1 instead of at 0. The last step 1 ÷ 2 gives quotient 0 and remainder 1, and that final 1 is your leftmost bit.
  • Cutting octal or hex groups from the left. Always group from the right and pad the leftmost group with zeros.
  • Writing 1 + 1 = 2 in binary. There is no digit 2. It is 10, which is 0 carry 1.
  • Forgetting that hex letters are digits: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
  • Dropping the subscript base. Write 101₂ so no one reads it as one hundred and one.

Where binary is used

Every file on your phone is a long string of bits. A photo, a song and a text message are all stored as patterns of 0 and 1, and a byte (eight bits) is the usual unit. Kilobytes, megabytes and gigabytes are counted with powers of two.

In networking, addresses are binary numbers written in decimal for humans. In web design, a colour like #1E90FF is three hex bytes, one each for red, green and blue. In programming, a flag that is on or off is one bit. This is why the ICT chapters on computer systems, data representation, networks and web design keep coming back to this one idea.

Exam corner

For SSC, HSC and admission questions on number systems, remember these.

  • Binary to decimal: write place values 1, 2, 4, 8 … from the right and add where the bit is 1.
  • Decimal to binary: divide by 2 until you reach 0 and read the remainders upward.
  • Binary to octal: groups of 3 from the right. Binary to hex: groups of 4 from the right.
  • Octal or hex to decimal: multiply each digit by a power of 8 or 16 and add, or convert to binary first.
  • Show the base as a subscript on every number and show every step. Method marks are awarded even when the last digit slips.

Frequently asked questions

What is the binary number system?

It is a way of writing numbers with only two digits, 0 and 1. Each column is worth twice the column on its right, so any whole number can be written as a list of switched-on place values.

How do I convert decimal to binary quickly?

Divide the number by 2 again and again, writing the remainder each time, until the quotient is 0. Then read the remainders from the bottom to the top. For small numbers you can also subtract the biggest power of two that fits, repeatedly.

Why do computers use binary instead of decimal?

Two states, on and off, are easy and reliable to build in hardware. A circuit that had to distinguish ten voltage levels would be costly and error-prone, so computers use two and build everything else out of them.

What is the use of octal and hexadecimal?

They are short ways to write long binary numbers. Three bits make one octal digit and four bits make one hexadecimal digit, so the conversion is just regrouping with no arithmetic.

How many values can 8 bits store?

Eight bits hold 256 different values, from 0 to 255. That is one byte.

Is this topic in the ICT book or the maths book?

Both. The number systems chapter in ICT (তথ্য ও যোগাযোগ প্রযুক্তি) uses exactly these conversions, and mathematics questions on number bases use the same method.

Keep studying this topic

The animation made the idea click; now turn it into marks. Syllabus, suggestions, textbooks and admission-test guides are below.

More math animations

Grade 8–10

Pythagorean Theorem

The Pythagorean theorem explained: formula a² + b² = c², two proofs you can watch, the converse, Pythagorean triples and 10 worked examples. Drag the triangle yourself.

Grade 10–11

Trigonometric Ratios and the Unit Circle

Drag a point round the unit circle and watch sin, cos and tan change. Standard angle table, ASTC signs, identities, radians and graphs, with solved examples.

Grade 9–11

Quadratic functions and their graphs

Drag the vertex and change a, b, c to see how a quadratic function graph moves. Learn factoring, completing the square, the quadratic formula and discriminant.

Grade 9–10

Circle theorems

All the circle theorems with drag-and-check diagrams: angle at the centre, same segment, semicircle, cyclic quadrilateral, chords, tangents and alternate segment.

Grade 9–10

Heights and distances: elevation and depression angles

What angle of elevation and angle of depression mean, how the height-and-distance formula works, and how two observations solve a tower's height without ever measuring it — with an interactive simulation and solved problems.

Grade 9–11

Probability: experimental vs theoretical probability

What probability means, how the sample-space formula P(E) = n(E)/n(S) works, and why experimental frequency edges closer to theoretical probability the more you flip, roll or draw — with a coin, dice and coloured-ball simulator.

Grade 10–11

Arithmetic and Geometric Sequences

Learn the arithmetic and geometric sequence formulas for the nth term and sum, Gauss's pairing trick, and the sum-to-infinity formula a/(1−r), with a drag-and-slide bar-chart simulation and worked examples.

Grade 9–10

Mean, Median and Mode

Learn the mean, median and mode formulas, why the median resists an outlier while the mean does not, and the grouped-data median/mode formulas, by dragging points on a number line, with worked examples.

Grade 7–11

Sets and Venn Diagrams

Shade union, intersection, difference and complement on a live Venn diagram, drop numbers into regions, check n(A ∪ B) and test De Morgan’s laws, with solved problems.

Grade 8–10

Linear equations: graphs, slope and simultaneous pairs

See slope, intercepts and angle on a straight line, then graph two linear equations to find where they meet. Learn the ratio test for one, none or infinite solutions.

Grade 10–12

Graphs of sin, cos and tan

Plot y = A sin(Bx + C) + D with sliders: see amplitude, period, phase shift, range and the asymptotes of tan live. Trigonometric graphs with solved examples.

Grade 9–10

Completing the Square and the Quadratic Formula

Watch algebra tiles complete the square, then solve quadratic equations, find the vertex and see why the formula works. Free interactive simulation with solved examples.

Grade 7–10

Area of a Circle: Proof, Formula and Solved Problems

Cut a circle into slices, slide them into a rectangle and watch the area become πr². Free interactive simulation with circumference, pi, sectors, arcs and solved problems.

Grade 8–10

Volume and Surface Area of Solids: Cube, Cuboid, Cylinder, Cone, Sphere

Rotate six solids in 3D, unfold their nets and pour a cone into a cylinder to see why it takes exactly three. Free simulation with volume, CSA and TSA formulas and solved problems.

Grade 8–10

Similar Triangles: Scale Factor, AA, SSS, SAS and Shadow Heights

Scale a triangle with a slider and watch angles stay equal, side ratios stay k and area grow by k². Free interactive similar triangles simulation with AA, SSS, SAS tests and shadow problems.

Grade 9–11

Coordinate Geometry: Distance, Midpoint, Slope, Section Formula and Locus

Drag points on a grid and watch the distance formula, midpoint, slope and section formula update live. Free coordinate geometry simulation with the perpendicular-bisector locus and solved problems.

Grade 11–12

Conic Sections: Circle, Ellipse, Parabola and Hyperbola

Tilt a plane through a double cone and watch a circle, ellipse, parabola or hyperbola appear, with its standard equation, foci and eccentricity. Free conic sections simulation with solved problems.

Grade 9–11

Function Transformations: Shifts, Stretches and Reflections

Pick x², |x|, √x, sin x or 2^x and drag sliders for a, b, h and k. Watch shifts, stretches, squeezes and reflections move the graph, with the parent faded behind. Free simulation with solved problems.

Grade 11–12

Derivative as the Slope of a Tangent: Secant to Tangent

Drag a point P on x², x³, sin x, eˣ or 1/x and shrink the gap h to zero. Watch the secant become the tangent and its slope become the derivative, with the derivative graph below. Free simulation.

Grade 11–12

Riemann Sums and Integration: Area Under a Curve

Cut the area under x², x³, sin x, eˣ or √x into up to 100 strips and compare left, right, midpoint and trapezoid sums with the exact integral. Watch the error melt away. Free simulation.

Grade 11–12

Limits and the ε–δ Definition: A Visual Guide

See the epsilon-delta definition of a limit. Pick a function, shrink ε and watch the δ band follow it, with left and right limits, a hole, sin x / x and a jump where no δ works. Free simulation.

Grade 11–12

3D Vectors: Sum, Dot Product and Cross Product

Drag to rotate two 3D vectors. See the sum as a parallelogram, the dot product as a shadow and an angle, and the cross product as a perpendicular arrow whose length is the area. Free simulation.

Grade 11–12

Matrix Transformations: Rotation, Reflection, Shear and the Determinant

Change a 2×2 matrix and watch the grid, a unit square and an F-shape move. See where i-hat and j-hat land, the determinant as signed area, and the inverse. Free simulation.

Grade 11–12

Complex Numbers: Sum, Product, Powers and Roots on the Argand Plane

Drag two complex numbers on the Argand plane. See the sum as a parallelogram, the product as a rotation and stretch, conjugates, powers as a spiral and roots of unity. Free simulation.

Animations in other subjects

Physics

Refraction of light

Physics

Ohm's law

Physics

Projectile motion

Physics

Simple pendulum

Physics

Electric field

Physics

Wave interference

Physics

Free Fall

Physics

Lens ray diagrams

Physics

Newton's Laws of Motion

Physics

Spherical mirror ray diagrams

Physics

Electromagnetic Induction

Physics

Conservation of Momentum and Collisions

Physics

Work, Energy and Power

Physics

Inclined Plane

Physics

Uniform circular motion

Physics

Transverse and Longitudinal Waves

Physics

Levers and moments

Physics

Centre of mass

Physics

Spring-mass SHM

Physics

Vector addition: triangle and parallelogram laws

Physics

Relative velocity: trains and river crossing

Physics

Kepler's laws and elliptical orbits

Physics

Newton’s law of gravitation, g and satellites

Physics

Standing waves in strings and pipes

Physics

Resonance tube and the speed of sound

Physics

Beats: when two close notes pulse

Physics

Doppler effect: moving sources, listeners and sonic booms

Physics

Prism, dispersion of light and the rainbow

Physics

Kirchhoff’s laws: junction rule and loop rule

Physics

Wheatstone bridge and metre bridge

Physics

Single-slit diffraction

Physics

Defects of the human eye and their correction

Physics

Polarisation of light: Malus’s law and Brewster’s law

Physics

Charging and discharging a capacitor: the RC time constant

Physics

Magnetic field lines: bar magnet, current-carrying wire and solenoid

Physics

AC generator

Physics

Transformer

Physics

Heat transfer: conduction, convection and radiation

Physics

Photoelectric effect: Einstein’s equation and the stopping potential

Physics

Motor effect: force on a current-carrying wire and the DC motor

Physics

Gas molecules and kinetic theory: pressure, temperature and speed

Physics

The semiconductor diode: p–n junction, I–V curve and rectifier

Physics

Radioactive decay: half-life, the decay law and penetration

Physics

The Bohr atom: orbits, energy levels and the hydrogen spectrum

Chemistry

Structure of the atom

Chemistry

Acids, Bases and the pH Scale

Chemistry

Electron configuration

Chemistry

Gas laws: Boyle, Charles, Gay-Lussac, Avogadro and PV = nRT

Chemistry

How an Ionic Bond Forms

Chemistry

Electrolysis and Faraday’s Laws

Chemistry

Covalent Bond

Chemistry

Periodic Trends

Chemistry

Reaction rate and collision theory

Chemistry

States of matter: solid, liquid, gas and the heating curve

Chemistry

Atomic orbitals: the shapes of s, p and d, quantum numbers and nodes

Chemistry

Molecular shapes and VSEPR theory: bond pairs, lone pairs and angles

Chemistry

The mole concept: molar mass, Avogadro’s number and molar volume

Chemistry

Diffusion and effusion: Graham’s law of gases

Chemistry

Balancing chemical equations: method, examples and practice

Chemistry

Chemical equilibrium: the equilibrium constant Kc and Le Chatelier’s principle

Chemistry

Titration: finding an unknown concentration with a burette and an indicator

Chemistry

Galvanic cell: the Daniell cell, EMF and the Nernst equation

Chemistry

Redox reactions: oxidation numbers, electron transfer and half-equations

Chemistry

Hydrocarbons: alkanes, alkenes, alkynes and structural isomers in 3D

Chemistry

Functional groups: alcohols, aldehydes, ketones, acids, esters and amines

Chemistry

Polymerisation: addition and condensation polymers, polythene and nylon

Chemistry

Separation techniques: filtration, distillation, chromatography, crystallisation

Chemistry

Crystal lattice: SC, BCC and FCC unit cells, packing efficiency and density

Chemistry

Radioactivity: Alpha, Beta, Gamma Decay and Half-Life

Biology

Mitosis cell division

Biology

Diffusion and Osmosis

Biology

Photosynthesis

Biology

The human heart: structure and function

Biology

Mendelian Genetics

Biology

DNA Replication

Biology

Cellular Respiration

Biology

Enzyme Action

Biology

The Nerve Impulse and the Action Potential

Biology

The Nephron and Urine Formation

Biology

Meiosis Cell Division

Biology

Digestive System

Biology

Breathing Mechanism: Inhalation and Exhalation

Biology

Protein synthesis

Biology

Blood circulation: double circulation and cardiac output

Biology

Cell structure and organelles: plant cell vs animal cell

Biology

Reflex action and the reflex arc

Biology

The human eye: parts, image formation and accommodation

Biology

Muscle contraction and the sliding-filament model

Biology

Transport in plants: xylem, phloem and transpiration

Biology

Food chain and food web: energy flow and the 10 % rule

Biology

Population growth: exponential and logistic curves

Biology

Natural selection: peppered moths and the sooty tree

Biology

Immune response: primary and secondary antibody response

Biology

Pollination and fertilisation