Decimal, Binary & Hexadecimal Converter
Convert numbers instantly between decimal (base 10), binary (base 2), and hexadecimal (base 16). Enter a value in any format and all outputs update in real time — ideal for digital logic, embedded programming, and memory addressing.
For educational and reference use only. Always verify results before use in real-world designs or safety-critical applications. For more information, see Calculation Assumptions and Disclaimer.
How to Use This Calculator
Select the format of the number you want to enter using the Input Format toggle — Decimal, Binary, or Hexadecimal. Then type your value into the input field. All three output formats update instantly as you type.
Use the display options below the input to control whether binary output is grouped into
readable 4-bit nibbles, and whether hex or binary prefixes (0x / 0b) appear on the
outputs. The Copy button beside each result copies it to your clipboard.
The Presets row at the top lets you jump straight to common reference values such as 8-bit, 16-bit, and 32-bit maximums.
Formula
Decimal to Binary — repeatedly divide the decimal value by 2 and record the remainders. Reading the remainders from bottom to top gives the binary representation.
Decimal to Hexadecimal — repeatedly divide the decimal value by 16 and record the remainders, mapping values 10–15 to letters A–F.
Binary to Decimal — multiply each bit by its positional power of 2 and sum all terms.
Hexadecimal to Decimal — multiply each digit by its positional power of 16 and sum all terms.
Bits required — the minimum number of binary digits needed to represent a value.
Variable definitions:
- N — the input integer value
- bit — a single binary digit (0 or 1)
- digit — a hexadecimal digit (0–15, i.e. 0–9 and A–F)
- position — digit position counting from the right, starting at 0
- Σ — sum of all positional terms
- ⌊ ⌋ — floor (round down)
Example
Input: 255 (Decimal)
Decimal → Binary: divide repeatedly by 2 and read remainders bottom to top:
255 ÷ 2 = 127 remainder 1
127 ÷ 2 = 63 remainder 1
63 ÷ 2 = 31 remainder 1
31 ÷ 2 = 15 remainder 1
15 ÷ 2 = 7 remainder 1
7 ÷ 2 = 3 remainder 1
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
Binary = 11111111
Decimal → Hexadecimal:
255 ÷ 16 = 15 remainder 15 (= F)
15 ÷ 16 = 0 remainder 15 (= F)
Hexadecimal = FF
Results:
Decimal: 255 | Binary: 11111111 | Hex: FF | Bits: 8
Frequently Asked Questions
What is hexadecimal and why is it used in electronics?
Hexadecimal (base 16) uses digits 0–9 and letters A–F to represent values. It is popular in electronics and
computing because each hex digit maps exactly to four binary bits (one nibble), making it a compact and
human-readable way to express binary data — for example, memory addresses, colour codes, and CPU registers.
What does "bits required" mean?
Bits required is the minimum number of binary digits needed to represent the value. For example, 255 requires 8
bits (11111111 in binary), while 256 requires 9 bits. This is useful for selecting register widths, data-type
sizes, and memory allocations.
What is a nibble in binary?
A nibble is a group of 4 binary bits. Because 4 bits can represent values from 0 to 15, one nibble corresponds
exactly to one hexadecimal digit. Grouping binary output into nibbles (e.g., 1111 1111) makes it easier to
read and cross-reference with hex values.
Can I enter hex values with the 0x prefix?
Yes. When Hexadecimal is selected as the input format, you can type the value with or without the
0x prefix (e.g., 0xFF or FF). The calculator strips the prefix
automatically before converting.
What is the maximum value this converter supports?
This converter uses JavaScript's BigInt type, so it supports arbitrarily large integers well beyond
the 32-bit and 64-bit limits. Practical limits depend on your browser, but values with hundreds of digits are
handled correctly.