Decimal to Binary Converter
Turn decimal integers into binary, including negative numbers as two’s complement at the bit width you need.
Processed locally in your browser· Your data stays in your browser.
What is Decimal to Binary Converter?
Binary writes a number using only 0 and 1, each position worth a power of two: decimal 42 is 101010 because 32 + 8 + 2 = 42. This tool converts each line you paste with exact big-integer arithmetic, so it is not limited to 32 or 53 bits.
Negative numbers can be shown with a minus sign (−101) or as a fixed-width two’s complement bit pattern, the way CPUs store signed integers: −5 in 8 bits is 11111011. You can also group the bits in nibbles or bytes, add a 0b prefix and pad to whole bytes.
How does it work?
- Paste one decimal integer per line.
- Choose how negatives are written: a minus sign, or two’s complement in 8, 16, 32 or 64 bits.
- Set grouping (4 or 8 bits), the 0b prefix and padding to a multiple of 8, 16, 32 or 64 bits.
- Copy the result; for a single number the rows also show hex, octal and the bit length.
Common use cases
- Checking bit flags and masks while reading or writing low-level code.
- Seeing how a negative integer is stored in an int8, int16 or int32 variable.
- Preparing binary literals for hardware registers or protocol fields.
- Verifying answers for computer-science exercises.
Examples
Try this input in the tool above:
42 -5 255
101010 -101 11111111
Privacy
Decimal to Binary Converter runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.
Limitations
Two’s complement needs a fixed width, so values must fit the range from −2^(N−1) to 2^N−1; anything outside is reported as an error on that line. Fractions are not handled here; use the Base Converter.
Frequently asked questions
How is −5 written in two’s complement?
Invert the bits of 5 and add one. In 8 bits: 00000101 → 11111010 → 11111011. Choose “Two’s complement, 8-bit” to see it directly.
Is there a size limit?
No practical limit for normal use: numbers of thousands of digits convert exactly. Only two’s complement modes are limited to their bit width.
How do I get a full byte for small numbers?
Set “Pad to a multiple of” to 8 bits, so 5 becomes 00000101 instead of 101.
Related tools
Binary to Decimal Converter
Read binary as a decimal number, either as a plain unsigned value or as a signed two’s complement integer.
Developer Tools
Decimal to Hex Converter
Turn decimal integers into hexadecimal, with byte grouping, a 0x prefix and fixed-width two’s complement for negative values.
Developer Tools
Binary to Hex Converter
Turn bit patterns into hexadecimal digit by digit, keeping every leading zero so the width of the value is preserved.
Developer Tools
Base Converter (Base 2 to 36)
Type a number, pick its base and the base you want, and get an exact result with a quick view in binary, octal, decimal, hexadecimal and base 36.
Developer Tools
Text to Binary Converter
Turn words into ones and zeros: each byte of your text is shown as eight bits.
Encoding & Decoding
IP to Binary Converter
See any IP address as bits, for example 192.168.1.1 → 11000000.10101000.00000001.00000001.
Network Tools
Hex to Binary Converter
Expand hexadecimal values into their exact bit patterns, four bits per digit, with optional grouping and padding.
Developer Tools
Decimal to Octal Converter
Type decimal integers and get their exact octal form, with a 0o prefix, grouping or fixed-width two’s complement when you need it.
Developer Tools