CBSE 2026 results are out, Mukul scored a perfect 100/100 in Computer ScienceSee all toppers →

KwickAcademy Course Topics · 6 min · free

Conversion of number representations

6 min1 KwickClipsFull text belowFree
Next lesson →Kajal Ma'am (MCA), teaching since 2004Remembered in this browser

Convert between decimal, binary, octal and hexadecimal: divide by the base, multiply by weights, or group bits. Decimal 25 is binary 11001, octal 31 and hexadecimal 19.

Follows the syllabus of: ISC Class 12 Computer Science (868)

On screen in this lesson

Four number systems

SystemBaseDigits used
Decimal100 to 9
Binary20 and 1
Octal80 to 7
Hexadecimal160 to 9, A to F

Place value

Each place has a weight: a power of the base
Decimal 352 = 3x100 + 5x10 + 2x1
Binary weights from the right: 1, 2, 4, 8, 16...
Write the base after the number: 11001 base 2

Decimal to binary: 25

Divide by 2QuotientRemainder
25 ÷ 2121
12 ÷ 260
6 ÷ 230
3 ÷ 211
1 ÷ 201

Binary to decimal: 11001

BitWeightValue
11616
188
040
020
111

Decimal fraction to binary

Multiply by 2ResultInteger part
0.625 × 21.251
0.25 × 20.50
0.5 × 21.01

Binary, octal, hexadecimal

ConvertGroup bits inExample
Binary to octal3s011 001 = 31
Binary to hex4s0001 1001 = 19
Octal to binary3 bits each31 = 011 001
Hex to binary4 bits each19 = 0001 1001

Quick answers

What is (1011.1) in base 2 as a decimal?

11.5 (8 + 2 + 1 + 0.5).

How do you write -5 in 8 bits using 2's complement?

11111011: flip the bits of 00000101, then add 1.

KwickClips from this lesson

Short clips, one idea each. Good for revision the night before.

The full lesson, in text

Hello students, welcome to Kwickprep. A computer stores the number twenty five as one one zero zero one. How do we get that, and back again? Today we will learn every conversion between decimal, binary, octal and hexadecimal.

The base of a number system is how many digits it uses. Decimal, our daily system, has base ten and digits zero to nine. Binary has base two and only zero and one, which a computer uses. Octal has base eight, with digits zero to seven. Hexadecimal has base sixteen, using zero to nine and then A to F, where A is ten and F is fifteen.

Every conversion depends on place value. Each position has a weight, which is a power of the base. In decimal three hundred fifty two, three is worth three hundreds, five is five tens, and two is two ones. In binary, the weights from the right are one, two, four, eight, sixteen and so on. To avoid confusion, write the base as a small subscript after the number.

To change decimal to binary, divide by two again and again, and write each remainder. Twenty five divided by two is twelve, remainder one. Twelve divided by two is six, remainder zero. Six divided by two is three, remainder zero. Three divided by two is one, remainder one. One divided by two is zero, remainder one. Now read the remainders from bottom to top: one one zero zero one.

To go back, multiply each bit by its weight and add. The first one has weight sixteen, giving sixteen. The next one has weight eight, giving eight. The zero with weight four gives zero. The zero with weight two gives zero. The last one has weight one, giving one. Sixteen plus eight plus one is twenty five, so we are back where we started.

For the fraction part, we multiply by two instead of dividing. Zero point six two five times two is one point two five, so write down one, and keep zero point two five. Zero point two five times two is zero point five, so write zero. Zero point five times two is one point zero, so write one, and stop because the fraction is zero. Read from top to bottom: zero point one zero one.

Since eight is two cubed and sixteen is two to the power four, there is a shortcut. For binary to octal, group bits in threes from the right. Add zeros on the left, so one one zero zero one is octal three one. For binary to hexadecimal, group in fours, so it becomes hexadecimal one nine. To go back from octal, write each digit as three bits. From hexadecimal, write each digit as four bits.

Decimal to hexadecimal uses the same division method, but by sixteen. One hundred seventy five divided by sixteen is ten, with remainder fifteen, which is the digit F. Ten divided by sixteen is zero, with remainder ten, which is the digit A. Read from bottom to top, and the answer is hexadecimal A F.

How do we convert octal to hexadecimal? There is no direct grouping between them. So we go through binary as a bridge. For octal five seven, five is one zero one and seven is one one one. Regroup those six bits in fours from the right, and we get two F in hexadecimal.

Pause and predict. Convert binary one zero one one point one to decimal. On the left of the point, the weights are eight, four, two and one. On the right of the point, the first weight is one half. So we get eight plus two plus one plus zero point five, which is eleven point five.

Computers store negative whole numbers using two's complement. First, write plus five in eight bits: zero zero zero zero zero one zero one. Next, find the one's complement by flipping every bit, so zeros become ones and ones become zeros. Then add one to get the two's complement. So minus five in eight bits is one one one one one zero one one.

Java can check your working. Integer dot parseInt, with a string and the base two, reads binary one one zero zero one as twenty five. Integer dot toHexString turns one hundred seventy five into hexadecimal. Notice that Java prints the hex digits in small letters. So the output is twenty five, space, a f.

Let us revise what we learned today. To change decimal to another base, divide again and again, and read remainders from bottom to top. To change any base to decimal, multiply each digit by its weight and add. For a decimal fraction, multiply by two and read the integer parts from top to bottom. Use groups of three bits for octal and groups of four for hexadecimal. For negative numbers, take the one's complement and add one. Practise with your own roll number today.

Courses that teach this

CourseUnit
ISC Class 12 Computer Science (868)Recursion

Voice-over in this lesson is AI-generated. The script is written and checked by Kajal Ma'am. Boards can revise a syllabus mid-year, so confirm anything you plan around against the official board circular. Keep your passwords, OTPs and ID numbers to yourself — we never ask for them. To reach Kajal Ma'am, use the WhatsApp button; sharing your number there is how we call you back.

Free to watch, no sign-up. Live classes with Kajal Ma'am are the paid course; these lessons stay free either way.

Want a plan that actually fits your board dates?

Ask Kajal Ma'am directly, 20+ years teaching computer science. Free demo class first, no payment.

Talk to Kajal Ma'am on WhatsApp

Or see the Class 12 Computer Science course →

Studying outside India?

We coach CBSE, IGCSE & international students across the globe, one-to-one, in your local time zone.

Visit International →