Number Base & Two's Complement Converter
Convert a value between binary, hexadecimal, decimal and octal at a chosen bit width. See its unsigned and signed (two's complement) interpretations, its two's-complement negation, sign extension, and a bit-by-bit breakdown, the everyday arithmetic of RTL and waveforms.
Results
- Unsigned decimal
- 49,374
- Signed decimal (two's comp)
- -16,162
- Hex
- 0xC0DE
- Binary
- 0b 1100 0000 1101 1110
- Octal
- 0o140336
- Two's-comp negation (-x)
- 0x3F22 = 16,162 unsigned
- Bits set (popcount)
- 8
Byte breakdown
| Bits | Hex | Binary | Dec |
|---|---|---|---|
| [15:8] | 0xC0 | 11000000 | 192 |
| [7:0] | 0xDE | 11011110 | 222 |
Notes
- This is a 16-bit value: unsigned range 0 to 65,535, signed range -32,768 to 32,767.
- Two's complement negate = invert every bit, then add 1.
About this tool
Fixed-width integers wrap: an N-bit register holds 0 to 2^N-1, and by convention the top bit marks the sign in two's complement, where -x is stored as 2^N - x. That's why reading a bus as signed versus unsigned can flip a number from 49374 to -16162 with no bits changing. This converter shows both interpretations, the two's-complement negation (invert the bits and add one), and flags when a value doesn't fit the width you chose.