What is base 10? Binary? Hexadecimal?
How can you convert from one base to another?
How do you count, add, and subtract in different bases?
Here are some explanations by our 'math doctors'. Follow the links to read
the full answers in the Dr. Math archives.
(For those of you trying to do multiplication in common non-decimal
(2, 8, 12, and 16), we have
multiplication tables for those bases.)
Introduction to Bases in Math
Rewrite the base 10 numeral in base 5: 13. I don't understand.
- Doctor Peterson
Arithmetic in Other Bases
How can I write out the steps for addition, subtraction, multiplication, and
division in other bases? For example: 5430/13 (base 6).
It's exactly the same, only different. If you follow the familiar
processes, but keep in mind the consequences of the digits meaning
powers of six instead of powers of ten, you will have it. Let's
use your example...
- Doctor Mike
in base 9 and base 5
Is there a general rule for adding numbers in any base?
In the decimal, or base 10, system, a three-digit number contains the hundreds,
tens and units positions - or 102, 101, and 100....
A three-digit number in base 5 contains the 52, 51, and 50
positions. The base 5 number 243 is not two hundred forty-three; instead, it is two
four three base 5. But we can convert it to a decimal number...
- Dr. Rob, Dr. Pipe
Scientists observe a class of young aliens through a telescope. These equations are
on their blackboard: 13 + 15 = 31, ... How many fingers do the aliens have?
Here is some information about your aliens. The number that we call ten is special
in our number representation system because the digits count powers of ten. For instance,
6345 means 6 times 10 cubed, plus 3 times 10 squared, plus 4 times 10, plus 5. If the
powers of a number smaller than ten, say B, are used, then we call it base B.
Now you are all set for the first clue...
- Dr. Mike
I need to know about this number system.
The Babylonian scale of enumeration is known as the sexagesimal system. What that means
is that the Babylonians used 60 as their base, much as we tend to use the decimal system
(base 10) in the United States. In the sexagesimal system, each time a "digit" is moved
to the left its value increases by a factor of 60. When you represent a whole number in
the sexagesimal system the last space "digit" is for the numbers from 1 to 59, the next
to the last space "digit" for multiples of 60, then the next space "digit" for multiples
of 60^2 = 3600, the next preceding space "digit" for multiples of 60^3 = 216,000, and so
- Doctor Mateo
What is 2 + 2 in base 3?
You have to start by distinguishing a number from a numeral (a way of writing a number).
The sum 2 + 2 is always equal to the NUMBER 4; the only question is how to WRITE this
number in base 3...
- Doctor Peterson
What is .23 in base 5? I know that 6 in base 5 is 11, 7 is 12 and so on. Would .23 be
the same in base 5 as it is in base 10?
Just as .23 means 2/10 + 3/100, so when we express a number less than 1 in base 5, say
the number .342 (base 5), we mean 3/5 + 4/25 + 2/125. If we let .23 = a/5 + b/25 + c/125
then multiplying both sides by 5...
- Doctor Anthony
I've been playing a game where I have to convert symbols to numbers. There are only
16 symbols, 0 through 15. How do you add and subtract in base 16?
In order to talk about different bases, we first need to agree on the digits that we
shall use in those bases. So for example, in the traditional base 10 system we use 10
digits: 0,1,2,3,4,5,6,7,8, and 9. In base 16 we must have 16 digits, and to try to
simplify things as much as possible, we use lots of base 10 nomenclature. This means,
for example, that 0 in base 16 represents the same thing as 0 in base 10; we put this
in equation form: 0(16) = 0(10), where the 16 and the 10 in parentheses refer to bases...
- Doctor Marko
Consider a base 26 number system where A=0, B=1, C=2, ..., Z=25 in base ten. Calculate
TWO+TWO in this system. Express your answer in base ten. Express 1997 in base 26...
First, you need to know what a "base" number system is and how it works. You can use
our number system, which is base 10, as a model for any other base you want. How does
base 10 work? Well, the base tells you how many digits you have. Base 10, ten digits.
Each digit will have a symbol. Base ten uses 0,1,2,3,4,5,6,7,8, and 9. Each digit
in a number you write out has a value dependent on where it is in the number.
- Doctor Wallace, Doctor Lorenzo
For example, look at 45. The rightmost digit is the "ones" column, and the one next to
it is the tens column. Each digit we place to the left gets a value 10 times as great
as the one to the right. In another base, the value with be n times as great, where n is
the base. In other words, what we're looking at is a sequence of powers. With base 10,
it's powers of 10. With base 26, it'll be powers of 26. So, we have 100 = 1
for the ones place. 101 = 10 for the tens place. 102 = 100 for
the hundreds. Then thousands, and so on. Now, to find the value of a number, we multiply
the digit in that spot by the power of ten which it corresponds to, and add up them up...
What does base number mean?
A nice way to think of it is to look inside a counter, like the odometer in a car or
the counter on some tape recorders, with a wheel for each digit. Each wheel has ten digits,
0 through 9; when it turns past 9 back to 0, it turns the wheel to its left one place,
meaning "we've just counted ten more; I've started over at zero, so please keep track of
the number of tens for me." Then that "tens" wheel counts until it turns back to zero,
and it tells the next wheel to count one more set of 100, or 10 tens. Another way to think
of it is that we count things by grouping them into stacks of ten, then stacks of ten into
stacks of ten tens, and so on. When we write "123" it means we have one stack of 100, two
stacks of 10, and three single items. You can do the same with other bases besides ten....
- Doctor Peterson
I would like a formula for base conversions.
Here it is, but I wouldn't call it a formula. It is more like an algorithm. That means
it is a method that always works, kind of like long division...
- Doctor Ethan
I'm enrolled in an adult computer course and we're supposed to learn how to convert
binary numbers to real numbers and binary to hexadecimal.
To convert a binary number to a decimal number you must first understand what each digit
in the binary number means. To explain this let's look at the decimal number 247.
The '2' in 247 represents two hundred because it is a two in the hundreds position
(two times a hundred is two hundred). In similar fashion, the '4' in 247 represents
forty because it is a four in the tens position (four times ten is forty). Finally,
the '7' represents seven because it is a seven in the units position (seven times one
is seven). In a decimal number, the actual value represented by a digit in that number
is determined by the numeral and the position of the numeral within the number.
- Doctor Pipe
It works the same way with a binary number... to convert the binary number 1001 (don't
read that as one thousand one - read it as one zero zero one) to decimal, you determine
the actual value represented by each '1' and add them together...
Can you explain binary addition, subtraction, multiplication, and division in a non-complex
Binary addition is the simplest of the binary operations, so let's start there. To add
two binary numbers, you only need to know three things:
- Doctor Mandel
0 + 0 is 0 carry 0 (pretty easy)
0 + 1 is 1 carry 0
1 + 1 is 0 carry 1.
... The next easiest operation is multiplication ...
I understand the rules of adding in binary, but how in the world do you subtract?
Actually, you subtract in binary pretty much the same way that you do in base 10.
You subtract digit by digit starting on the right side. If the subtraction cannot be
made (for example, you cannot subtract 1 from 0), you must then "borrow", just as you
do in base 10 subtraction. But when you borrow a "one" from the 4's digit, it turns
into two 2's. This borrowing by two's (rather than 10's) is what makes it quite
different from base 10 subtraction...
Doctor Robert, Doctor Anthony
I need help understanding the rules of subtracting
binary numbers when the subtrahend is larger then the minuend. For
example, I see from the answer provided in a textbook the that 101101 - 111101 is -010000 but I can't figure out how the leading -0 was obtained in
Let's start by thinking about the more familiar base 10. You'll find that the same problem exists there, but you probably don't stop to think about it because the solution is more familiar there. We can't subtract a larger number from a smaller one columnwise, because the sign gets mixed up. Instead, you reverse the order of the numbers, subtract, and take the negative. Now, there are a couple of alternative ways to do this...
Divisibility by 10
How you can tell whether a binary number of arbitrary size is divisible by 10 without
looking at the whole number?
I'll first show you the strictly binary method, since it can be instructive, then
I'll show you the better way, which in fact is just like the decimal rule for
divisibility by 3.
Long Division in Binary
My problem is 1011 base 2 divided by 11 base 2.
You can use the same algorithm as long division in decimal, but the
values will go in either one time or 0 times. Let's do a similar
example: 1000101 / 1100 (this is 69/12 in decimal)...
Is there a simple way to convert from binary (base 2) numbers to hexadecimal (base 16)
A big part of the reason that we use hexadecimal is that it is relatively easy to
convert between binary and hexadecimal. Hexadecimal numbers are closely related
to binary, but they are shorter and easier to read than binary. Group the binary
digits into groups of 4 starting from the right...
Changing number bases
Could I have some information on hexadecimal and binary for my classes?
We usually deal with base ten, which is just a way that's convenient for us to write
down numbers. It means that if we have the number 9745,
that's 9*103 + 7*102 + 4*101 + 5*100.
If there are numbers after the decimal point, you just continue the pattern: 234.95 =
2*102 + 3*101 + 4*100 + 9*10-1 + 5*10-2.
- Doctor Ken
The only difference between base 10 and base anything else is that we replace 10
(as in 9*10^3) with the new number, and instead of using 10 digits, we now use however
many digits our base is. So in base 2 (binary) we use 2 digits, 0 and 1, and in
base 16 (hexadecimal) we use 16 digits: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e, and f.
To convert the number 984 to hexadecimal, we'd try to write it as
w*163 + x*162 + y*161 + z*160,
where w,x,y, and z are between 0 and 15(f)...
of a number
What is the method for finding the complement of a number? What about the binary
To complement a number in base 10, you subtract it from a row of 9's: the complement
of 5097 is 4912. Likewise, in base 2, the complement of a number is obtained by
subtraction from a row of 1's. All you have to do in fact is to interchange 0's and 1's:
the complement of
- Doctor Anthony
1 0 0 1 1 1 0 1 0 1 1 is
0 1 1 0 0 0 1 0 1 0 0
In binary, a convenient way to subtract is to add the complement...
Adding in Base 2
I don't understand the whole concept of base 2...
Let's see if we can relate base two to something you can picture easily. You've
probably seen an odometer in a car, or a tape counter in a cassette player, or
things like that. They have a set of wheels, each of which has the ten digits
0, 1, ... 9 on it...
- Dr. Peterson
How do you convert hexadecimal, binary, and decimal numbers?
First, be sure you understand exactly what numbers mean in the old familiar decimal
system. If I write 3409, what it really means is 3*1000 + 4*100 + 0*10 + 9*1...
- Doctor Tom
I can also write it as:
3*103 + 4*102 + 0101 + 9*100
(remember that 100 = 1). Now there's nothing magic about 10 - it was chosen
because we happen to have 10 fingers. If humans had 7 fingers, you can bet that we'd
be writing numbers like this:
3204 = 3*73 + 2*72 + 071 + 4*70.
I need to learn the art of converting from one base to another - i.e. decimal to bin,
hex, and oct.
There is a trick you can use, and after a little practice you won't have to write
down the steps any more. Let's go from base 10 (decimal) to base 16 (hex) with the
number 3457 (decimal)...
- Doctor Kate
from one base to another
I need assistance understanding how to convert a radix equation:
9, 18075, 4: (9 = the base we start in; 18075 = the number we are converting;
4 = the base we are converting to). I want to be able to follow a formula...
...to convert a number in any given base to its base 10 form, you use the powers as
you showed. For instance 142 base 5 MEANS:
- Doctor Donald
1*52 + 4*51 + 2*50 = 1*25 + 4*5 + 2*1 = 25 + 20 + 2 = 47
which is what it is supposed to be. Converting 18075 base 9 to base 10 is the same
kind of process, only with more arithmetic...
numbers: binary to decimal
I am taking Computer Science and can't get how to convert from binary to decimal and
back again. Is there a simple formula?
The easiest half is to convert from binary to decimal. Just remember that the first
place to the left of the "decimal" point is 20 = 1, the second place is
21, and so on; to the right of the "decimal" point is
2(-1) = 1/2 in the first place, 2(-2) = 1/4 in the second place,
and so on... Going the other way is slightly harder...
- Doctor Jerry
Converting Fractions from Binary to Decimal
Can you explain how to convert binary fractions to decimal numbers, e.g.
Methods and an example of converting a fraction FROM binary back TO decimal...
- Doctor Twe
base 16; place value chart
How do you convert numbers to base 16 numbers? Please use the following numbers in an
example: 411213 and 38015.
Here's one way to think about other bases. If you were given 3 hundred-dollar bills
and 4 ten-dollar bills and 2 one-dollar bills you would have 342 dollars. We can just
"glue" the 3 and the 4 and the 2 together because our decimal number system is based
- Doctor Sam
Now if I gave you 3 quarters and 4 nickels and 2 pennies you wouldn't have 342 cents
because nickels are only worth five pennies and quarters are only worth five nickels.
But in base 5 notation that is just what you would write down. In base 5 notation
every place value is five times as large as the one before it. So 3 quarters, 4 nickels,
2 pennies would be written as 342 base 5... Here is a chart of some place values in
From binary to octal, base 4 to base 16
How do I convert numbers from one base to another without converting to a base 10 equivalent first?
- Doctor Mike
Given a binary number you start by grouping the binary "1" and "0"
digits in groups of 3, starting at the right. Then convert each of
these groups into one octal digit.
This does not work for bases 5 and 20, but it does work for 4 and 16...
in base 6, 12, 16
In a base six system how do you count to 25? Do you ever use the numeral 7? In a
duodecimal system (base twelve) why are letters sometimes used instead of numbers?
In the base six number system, you would never use the numeral 7, only numerals from
0 to 5. The idea of base six is just like the normal base ten system, except that
instead of using the digits 0 to 9, we use digits 0 to 5, and instead of having a
ones digit, a tens digit, a hundreds digit and so on, we use a ones digit, a sixes
digit, a thirty-sixes digit, and so on. So in base 6, the number 321 means 1 one plus
2 sixes plus 3 thirty-sixes, or 121...
- Doctor Darrin, Doctor Byron
For base twelve, we would want to use digits from 0 to eleven, but there are no digits
that mean ten or eleven, so we generally use A and B for these digits, and the place
values would be ones, twelves, one-hundred-forty-fours, etc. So A2 in base twelve would
mean ten twelves plus two ones, or 122. In fact, in the hexadecimal system (base 16),
which is used a lot in computer science, the letters A through F are used for digits
(since we need digits for each number from 0 to 15).
100 Factorial in Base 6: How Many Zeros?
How many zeros are at the end of 100! in base 6?
In base 10, you get a zero at the end of a product if one of the factors contains
a prime factor of 5 and another of the factors contains a prime factor of 2.
The prime factors of 2 and 5 multiplied together make 10 and produce a 0 at the end
of the product...
- Doctor Greenie
Conversion to Other Bases
What are the rules for converting fractions to binary and octal and vice versa?
That's a good question. We tend to talk almost entirely about integers when we
discuss different bases, which leaves out a lot of good information. I'm going to
give you the whole picture: how to work with both integers and fractions in other
bases. What's interesting is that you have to use different but sort of opposite
methods for the integer part of a number and the fraction part...
- Dr. Peterson
Base 12 Fractions
I need a simple way to understand how to do and interpret fractions in base 12.
One short and one lengthy answer.
- Drs. Peterson and Greenie
I know the binary system using base two, but I don't understand the hexadecimal system
using base 16.
If you know the binary number system, then you understand that it is a place-value
system like ordinary decimal numbers. The two threes in 343 (base 10) stand for different
things, and so do the two ones in 101 (base 2).
- Doctor Sam
In hexadecimal, the place-values are all powers of 16: ...
163 162 161 1. So the number 952
in hexadecimal notation means 9(162) + 5(16)+ 2, which is the decimal number
One of the advantages of hex notation is that you can name larger numbers with fewer
digits than in decimal notation (it takes four digits to write 2386 in decimal and only
three digits to write the same value in hexadecimal.) One of the problems with hex
notation, however, is that in order to get bigger values into fewer digits we need
Large-Number Binary Conversion
How do you convert very large binary numbers like 2^50 to base 10?
There are two basic methods for converting whole numbers from binary
(or any other base) to base 10. Here are the two methods, used to
convert the binary number 11001 to base 10...
- Doctor Greenie
Mensa: Numbering for
an alternate world
In a parallel universe, the numbering system in use is based on the 26-character Roman
alphabet. A is the number ), B is the number 1, C is the number 2, and so on, through
Z is the number 25...
This problem revolves around an understanding how different bases work... In base 2
you use only 2 digits, 0 and 1. The different base systems all revolve around one main
unifying concept... In your problem we are dealing with base 26...
- Dr. Sydney
decimal representations of fractions
Why is it that you can take a perfectly finite, limited quantity like one-third and you get
three and only three pieces, but when you turn it into a decimal you get .333... on into
Base 2 and base 16 are heavily used in computers, but base ten (decimal) is so heavily
entrenched that the only other example I can think of where another base is commonly used is
in old-style counting: dozen = 12, gross = 144 = 12*12, great gross = 1768 = 12*12*12.
It's sort of a start of a base 12 system.
- Doctor Tom
In case you don't know about base systems, think about counting in decimal. Everything is
regular in the units digit until you get to nine, but the next step "overflows," and drives
the 9 to zero, but pumps up the next digit over (which may overflow itself - 99 => 100
-- and so on). In base 5, for example, counting would go like this: 0,1,2,3,4, 10,11,12,13,14,
20,21,22,23,24, 30,31,32,33,34, 40,41,42,43,44, 100,101,102,103,104, 110,...
Base 3 is like this: 0,1,2, 10,11,12, 20,21,22, 100,101,102, 110,111,112, 120,121,122,
200,201,202, 210,211,212, 220,221,222, 1000,1001,1002,... Stare at these until you
get the pattern. It's just like the decimal system, but the overflow occurs earlier...
Operations in Nondecimal Bases
Is it possible to subtract, multiply, and divide numbers in other bases?
The operations all work the same in any base; the only things that are different are the tables....
- Doctor Peterson
Prime Numbers in
Are all prime numbers the same in all bases?
A prime is a prime no matter which base you use to represent it. On the surface one might
think that in Hex you would have 3*5 = 15 as "usual," but it really turns out that 3*5 = F....
The fact of being prime or composite is just a property of the number itself, regardless
of the way you write it....
- Doctor Mike
Numbers in Different Bases
How do you express 200_(10) in (a) base two, (b) base three, and (c) base four?
It looks like you're having trouble making the jump from a picture of what a base means
to a method for writing a number in some base. What you have described is a very slow
way to figure out a base three representation, which is probably meant just to show
what base three is all about. The usual way to write a number in base three is
sort of the reverse of what they did...
- Dr. Peterson
Why are all repeating
decimals classified rational?
Please explain to us how .6 repeating can be a rational number when expressing it over 10's,
It's just an accident of nature that we work in base 10 - we happen to have 10 fingers.
Since the decimal system uses 10, when we write decimal forms for certain fractions,
they come out even, (like 1/2, 1/5, ...), and for others, they repeat: 1/3 = .33333...
If humans had 8 fingers and we used a base 8 system, the same problems would exist,
except that a different set of fractions would "come out even," and a different set
would have a repeating "octal" (not decimal) expansion...
- Doctor Ceeks, Doctor Tom
Working with different
Could you please explain base 10 to me? Then base 4?
We have ten symbols for counting (0,1,2,3,4,5,6,7,8,9). So what do we do when we need
to use numbers higher than 9? We make different places in our numbers and know that each
place has a different meaning. The first place is the "ones" place. The second is the
"tens". The third is the "hundreds" and so on. Each place is ten times greater than the
one to its right. So the number 159 means: 1 hundred + 5 tens + 9 ones.
- Doctor Steve
Base four works the same way but we only have four symbols (0,1,2,3) for counting and
each place is four times greater than the one to its right. In base four the number 203 means:
2 sixteens + 0 fours + 3 ones.
For more answers from the Dr. Math archives,
Dr. Math for base 2 (select "that exact phrase"), binary, base 5, base 10,
base 26, hexadecimal, etc. See, especially,
On the Web:
- Base 10, Base 2, and
Base 16 - Walter Davis
There are several ways to represent a value using symbols. Roman numerals are an
example. Position valued representation (PVR) is another example, the one with which we
are the most familiar. With PVR, a limited number of symbols (digits) are used...
- Base Converter - A. Bogomolny
A fairly high-level introduction to binary and other base systems, with a Java converter and links to
related pages including: arithmetic operations in various bases, algorithmic conversion procedure,
linguistic fun with base 36, Napier bones, abacus, conversion of fractions, and a number guessing
- Binary Number System - Ken Dunham,
An introduction to the base 2 system for those interested in computers and cryptology. Includes a
review of base 10.
- Converting Numbers Into Binary, Octal, and Hexadecimal Values
Enter a number to see how it appears in base 2, base 8, and base 16 numbering systems.
- Elias' Pi Page - Binary Pi
Read through the 32768 first bits of binary Pi. Listen to the 65536 first bits of binary Pi.
Look at the bits of binary Pi.
- Number System - Computer
Methods in Chemical Engineering course
By Prof. Nam Sun Wang of the University of MD in College Park. A handout from his course,
detailing bit and byte definitions, number system background, and conversions among binary,
octal, decimal, and hexadecimal systems.
Decimal, Binary, Hexadecimal - Exploring MIDI
An explanation of base 10, base 2, and base 16 for people studying MIDI digital information transmission.