Decimal to Binary Converter
Convert decimal numbers to binary with a chosen bit width, two’s complement for negatives and fractional parts.
Your inputs
Results
8-bit two’s complement
1111 1011
- Hexadecimal
- FB
- Binary of the magnitude
- 101
✓Exact calculation — rounded only for display
What this calculator does
Choose a bit width to see padded binary, or how negative numbers are stored in two’s complement.
Formula and method
Repeated division by 2 for integers; negatives: 2ⁿ + value; fractions: repeated multiplication by 2
Worked example
Calculated by this tool with its default inputs:
Inputs
- Decimal number: -5
- Bit width (for negatives and padding): 8-bit
Results
- 8-bit two’s complement: 1111 1011
- Hexadecimal: FB
- Binary of the magnitude: 101
How to read the results
Fractions like 0.1 cannot be represented exactly in binary and repeat.
Assumptions and limitations
- Bits are grouped in fours for readability.
Questions
What range fits in 8 bits signed?
−128 to 127.
Methodology and verification
- Result type
- Exact mathematical calculation (rounded only for display)
- Formula version
- 1.0
- Automated verification
- 5 reference and validation test cases, checked against independently computed values. The site cannot be built if any of them fail.
- Editorial review
- Awaiting human editorial review. The explanation was drafted with AI assistance; the formula and examples are verified by the automated tests above.
Privacy
Everything you enter is calculated in this browser and is not sent to Numerith or anyone else. Inputs are added to a share link only if you choose to include them. Privacy policy