About the Decimal to Binary Converter
Binary is the language of digital electronics, and converting decimal numbers by hand is a standard exercise in computing courses. This decimal to binary converter works exactly for whole numbers of any length using big-integer arithmetic, so even very large values are never rounded: 2026 becomes 11111101010. It shows the repeated division by 2, with each remainder, so you can follow the method, and gives hexadecimal and octal results too.
The converter uses the repeated-division method you would use on paper: divide by 2, keep the remainder, divide the quotient again, and read the remainders backwards. Every division is listed in the working section so you can follow or check it. Examples: 5 in decimal is 101 in binary; 42 in decimal is 101010 in binary; 255 in decimal is 11111111 in binary.
Binary is the language of digital hardware: every value a computer stores is a pattern of bits, so converting decimal numbers to binary is a core skill in computer science, electronics and networking courses. It also explains everyday limits, such as why an 8-bit value tops out at 255 (11111111) and why IPv4 subnet masks look like 255.255.255.0 (eight 1s in each of the first three octets).
Other bases are covered by the number base converter, which converts between any bases from 2 to 36. For arithmetic in these bases, use the binary calculator or the hex calculator; to turn text into its binary character codes, use text to binary.
How to use the Decimal to Binary Converter
- Enter the decimal numberType or paste the number. Whole numbers of any length, positive or negative. Commas are ignored.
- Read the binary resultThe binary value appears instantly, along with the octal and hexadecimal equivalents.
- Follow the workingOpen the step-by-step section to see how the conversion was done, digit by digit or division by division.
- Copy or shareCopy all results with one click, or copy a link that reopens the converter with the same number.
Decimal to Binary Converter features
- Exact conversion of numbers of any length using BigInt arithmetic
- Step-by-step working for homework and exam practice
- Octal and Hexadecimal results shown alongside
- Negative numbers with 8- to 128-bit two's complement forms
- Optional digit grouping (4 bits, 2 hex digits or thousands) for easy reading
- Accepts prefixes such as 0x, 0b and 0o and ignores spaces and underscores
- Runs in your browser with nothing sent to a server
Common uses
- Checking computer science and digital electronics homework
- Reading values from datasheets, debuggers and log files
- Working out color codes, permissions and bit masks
- Converting values for programming and scripting
- Learning how positional number systems work
Decimal to binary in practice: two methods for exams, subnet masks, flags, colour depth and why 0.1 is never exact
Converting decimal numbers to binary is a staple of computer science exams and a skill that keeps appearing in networking, programming and digital media. This guide works through a conversion with two methods, then shows binary at work in subnet masks, feature flags and colour depth, and explains why decimal fractions such as 0.1 cannot be stored exactly by computers.
A worked example: 200 in binary
By repeated division, 200 divided by 2 gives remainders that, read from the last to the first, spell 11001000. The second method uses powers of two: the largest power not exceeding 200 is 128, leaving 72; then 64, leaving 8; then 8, leaving nothing. Placing ones under 128, 64 and 8 and zeros elsewhere gives the same answer, 11001000. Using one method and checking with the other is a reliable exam habit.
Powers of two to memorise
Knowing the first powers of two, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 and 1024, makes the subtraction method fast enough to do in your head. These numbers also appear constantly in computing, in memory sizes, image dimensions and limits such as the 255 maximum of a single byte.
Subnet masks
Network masks are easiest to understand in binary. The mask 255.255.255.192 is 24 ones followed by 11000000 in the last byte, 26 ones in total, which is why it is written as /26. Converting the last byte of a mask to binary immediately shows how many addresses the network holds.
Feature flags and permissions
Programs often store several yes-or-no settings in one number, each bit standing for one option. A value of 13 is 1101 in binary, meaning the options at positions 1, 3 and 4, counting from the right, are switched on and position 2 is off. Converting such values to binary makes their meaning instantly readable.
Colour depth
Each colour channel in a typical image uses 8 bits, giving 256 levels of red, green and blue. Together that is 24 bits, enough for 16,777,216 colours. Understanding this explains why images edited repeatedly in 8-bit mode can show banding, and why professional editors work in 16 bits per channel.
Why 0.1 is never exact
Just as one third cannot be written exactly in decimal, 0.1 cannot be written exactly in binary: its binary form repeats forever. Computers store a close approximation, so adding 0.1 and 0.2 in many programming languages gives 0.30000000000000004. For money, programs avoid this by working in whole paisa or cents, or by using decimal number types.
Common exam slips
- Reading remainders in the order they were produced instead of reversing them.
- Dropping leading zeros when the question asks for a full 8-bit byte.
- Forgetting the final division that produces the leading 1.
- Mixing up the place values when using the subtraction method.
Grouping digits
Long binary numbers are easier to read when grouped in fours from the right, so 11001000 becomes 1100 1000. Each group also corresponds to one hexadecimal digit, here C and 8, giving C8. This grouping makes checking answers and converting onwards to hexadecimal much faster.
Mental practice
Doubling and halving are the only arithmetic needed for binary, so short daily practice builds speed quickly. Converting ages, dates and prices you see during the day, then checking with the converter, turns the method into a habit well before an exam.
Common mistakes
- Using floating-point numbers for money calculations.
- Misreading the bit positions in flags.
- Assuming binary conversions of fractions terminate.
- Not checking answers by converting back.
Related tools
To convert onwards to hexadecimal, use Decimal to Hex Converter. To see masks in action, try IP Subnet Calculator, and to group binary into hex digits, Binary to Hex Converter.
Shifting bits
Moving every digit of a binary number one place to the left doubles it, and moving it one place to the right halves it, dropping any remainder. Programmers use these shifts, written with the shift operators in most languages, for fast multiplication and division by powers of two and for building values bit by bit.
Odd and even at a glance
The last binary digit shows whether a number is odd or even: 1 means odd, 0 means even. That is why programs often test a number's lowest bit to check whether it is even. It is also a quick sanity check on exam answers, since an odd decimal number must end in 1.
Counting to 1023 on your fingers
Treating each finger as one bit, up or down, lets you count from 0 to 1023 on two hands, because ten bits can represent 1,024 different values. It is a memorable way for students to feel how quickly binary capacity grows as bits are added.
Binary-coded decimal
Some clocks, calculators and older devices store each decimal digit separately in four bits, a format called binary-coded decimal. In that form, 59 is written 0101 1001, one group for each digit, while its pure binary value is 111011. Knowing both formats helps when reading electronics datasheets and exam questions that mention them.
Privacy
Conversions run in your browser. Nothing you enter is sent anywhere or stored.
Frequently asked questions
How do I convert decimal to binary by hand?
Divide the number by 2 and write down the remainder (0 or 1). Keep dividing the quotient by 2 until it reaches 0. The binary number is the remainders read from the last one to the first. For 13: remainders 1, 0, 1, 1 give 1101.
What is the largest number this converter can handle?
It accepts up to 400 digits, far beyond the 64-bit limit of 18446744073709551615 (2^64 − 1). The calculation uses arbitrary-precision integers, so even very long numbers convert exactly without rounding.
Can I convert negative numbers?
Yes. Put a minus sign in front and the result keeps the sign, for example -5 in decimal is -101 in binary. For binary work, the details section also shows the two's complement form that computers use to store negative integers.
Does it convert fractions or decimal points?
No. The converter works with whole numbers, which is what bases are used for in computing. Fractional values such as 0.1 often have infinitely repeating forms in binary, so they need a separate floating-point tool.
Why are the digits grouped?
Grouping makes long numbers easier to read and check: binary is split into blocks of 4 bits (one hex digit each), hex into pairs (one byte each) and decimal into thousands. Untick the grouping option to get one continuous string for copying into code.
How many bits do I need to store a number?
Find the smallest power of 2 above the number: n bits hold values from 0 to 2^n − 1. So 8 bits hold 0 to 255, 16 bits hold 0 to 65,535 and 32 bits hold 0 to 4,294,967,295. The details section shows the bit count for your number.