Free online calculator
Number bases & bits calculator
One value shown in binary, decimal, hex and octal at once, with every bit clickable. Reading 0x2A is arithmetic; seeing 00101010 with bits 5, 3 and 1 lit is not — and that is what a datasheet's register table is really asking you to do. The mistake this exists to stop: the same bits are one number unsigned and a different one signed, so a sensor reporting −21 arrives as 65515 the moment you store it in an unsigned 16-bit variable. Type in any field — 0x2A, 0b101010, 0o52 or 42 all work anywhere.
Example 42 = 0x2A = 0b00101010 = 0o52
Example 8-bit — unsigned 42, signed +42 — bits 5, 3, 1 set — as ASCII: '*'
Signed or unsigned — same bits, two answers
once the top bit is set; identical below that. Nothing in the register says which one is meant — only the type in your code does.
Bitwise operation
A is the value above. Setting, clearing and testing a flag are these four lines and nothing else: REG |= MASK, REG &= ~MASK, REG ^= MASK, if (REG & MASK).
Example 0x2A & 0x0F = 0x0A — A has 2 of B's bits set
Example 10 = 0x0A = 0b00001010 = 0o12 — signed 10
ASCII
Half of serial debugging is deciding whether the byte you are staring at is a number or a letter. 0x41 is 65 is 'A'; there is no difference in the wire, only in how you print it.
Example 'A' = 65 = 0x41 = 0b01000001
Printable characters (32–126)
␣ is the space, code 32. Everything below 32 is a control code, and 127 is DEL — those are in the table under this one.
Control codes worth knowing
What you enter
- Width
- Decimal — base 10
- Hexadecimal — base 16
- Binary — base 2
- Octal — base 8
- Operation
- Operand B
- Character
- Code point





