RevealTheme logo

Decimal to Binary Converter

Type a base-10 integer and instantly see it written in binary, hexadecimal, and octal at the same time.

How to use this tool

  1. 1

    Type or paste a decimal (base-10) whole number into the input box.

  2. 2

    Read the binary, hexadecimal (shown with a 0x prefix), and octal forms in the table that appears below.

  3. 3

    Change the number to convert a different value, or clear the box to hide the results.

  4. 4

    Copy any line of output you need straight from the table into your code or terminal.

What does converting decimal to binary actually mean?

Decimal is the base-10 system humans use, with digits 0 through 9. Binary is base-2, using only 0 and 1, which is how data is physically represented in a computer's memory and registers. Converting from decimal to binary means rewriting the same quantity as a sum of powers of two: for example, 13 becomes 1101, because 8 + 4 + 0 + 1 = 13. Hexadecimal (base-16) and octal (base-8) are shorthand for binary because each hex digit maps to exactly four bits and each octal digit to three, making long bit strings easier to read. This tool does the conversion with the browser's built-in Number.toString method after parsing your input with parseInt in base 10. That means it works on standard JavaScript numbers, so reliable, exact results are limited to safe integers up to 9,007,199,254,740,991 (2^53 - 1). Negative numbers are shown in sign-magnitude form with a leading minus, not in two's-complement, and any fractional part you type is truncated before conversion. There is no fixed bit width or zero padding: you get the minimal representation of the value.

Common use cases

  • Checking the binary pattern of a value while debugging bitmask or flag-based logic in your code.

  • Translating a decimal color or byte value into hex when writing CSS, HTML, or low-level data.

  • Working through computer-science homework on number bases and verifying your hand conversions.

  • Reading an octal Unix file-permission value such as 755 and seeing its binary bits.

  • Confirming what bits an embedded-systems register value sets before flashing firmware.

  • Quickly converting a network or protocol constant between decimal, hex, and octal during analysis.

Frequently asked questions

Does this convert fractional or decimal-point numbers?
No. The input is parsed as a whole number, so anything after a decimal point is dropped. Typing 6.9 converts the same as 6.
How are negative numbers handled?
A negative value is shown with a leading minus sign in front of its magnitude (sign-magnitude), for example -5 becomes -101 in binary. It is not shown as a two's-complement bit pattern, so this is not the raw form a fixed-width CPU register would store.
Is there a maximum number I can convert?
Conversions are done with standard JavaScript numbers, so exact results are guaranteed only for integers up to 9,007,199,254,740,991 (2^53 - 1). Beyond that, floating-point rounding can make the output inaccurate.
Why is the hex shown with a 0x prefix and the binary without one?
The 0x prefix is the common notation for hexadecimal literals in many languages, so it is included for readability. The binary and octal outputs are shown as plain digit strings without a 0b or 0o prefix.
Does it add leading zeros or pad to a byte or word width?
No. You get the shortest representation of the value with no padding. For instance 5 shows as 101, not 00000101. If you need a fixed width, pad the result yourself.
Is my input sent to a server?
No. The entire conversion runs locally in your browser using built-in JavaScript number methods. Nothing you type is uploaded, logged, or stored.
Can I get back decimal from binary here?
This page only goes from decimal to binary, hex, and octal. For the reverse direction, use a binary-to-decimal converter.

Related tools