Binary Converter
Enter a decimal value in the Decimal field and read the Binary line as soon as the number is valid. Whole numbers convert directly; fractional parts are dropped with truncation before the base-2 string is built.
Updated 2026-08-03 · math
About this tool
The converter watches a single Decimal input. When the value is a finite number, it truncates toward zero with Math.trunc, then calls toString(2) to produce a Binary line. Non-numeric input shows Enter a number so you know the field still needs a real value.
How to use
- Focus the Decimal field: Open the tool and click the Decimal input (sample default is 42).
- Type your number: Enter the decimal value you want shown in binary.
- Read the Binary line: When the input is valid, the result shows Binary: followed by the base-2 digits.
- Correct bad input: If you see Enter a number, replace letters or empty text with a finite numeric value.
Common use cases
- Turn homework decimals into binary for CS or electronics exercises.
- Preview bit patterns when sketching flags, masks, or small opcodes.
- Quickly check what binary representation a sample integer uses.
Tips
- Only the integer portion is converted—42.9 becomes the same binary as 42.
- Negative numbers keep the minus sign in front of the binary digits where supported by the runtime string.
FAQ
Is conversion live or button-based?
Live. The Binary line updates whenever the Decimal field changes.
What happens to decimals like 10.7?
The tool truncates toward zero first, so 10.7 converts as 10 → 1010.
Can I convert binary back to decimal here?
This page only maps decimal input to a binary string, not the reverse.
Why do I see Enter a number?
The field is empty or not a finite number, so no binary string is produced yet.