Binary & Hex Converter

Convert binary, decimal, and hexadecimal while reading IoT bytes and registers

animation
binary
hexadecimal
fundamentals
beginner
Interactive animation Number systems IoT debugging

Binary & Hex Converter

Turn one IoT value into decimal, hexadecimal, and binary. Then inspect each bit so raw sensor bytes, GPIO registers, and protocol headers become readable instead of mysterious.

165Unsigned decimal
0xA5Hexadecimal
0, 2, 5, 7HIGH bit positions
Goal
Read raw IoT numbers without guessing what each digit means.
Try
Load the GPIO example, then click the bit cells that are HIGH.
Watch
One hex digit maps to exactly four binary bits.
Apply
Use the scenario cards to decode sensor bytes and protocol headers.

Converter Setup

Use prefixes if helpful: 0xA5 or 0b10100101.

Live Numbers

Unsigned
165
Signed
-91
Hex
0xA5
Binary
1010 0101
Selected Bit
bit 0 = 1
Weight
1

Number Conversion Animation

The same value is shown in three number systems. Step through the process to see why hex is a compact way to write binary bytes.

Normalize
1. Normalize inputClean prefixes and choose the base.
2. Fit the wordClamp to the selected bit width.
3. Map nibblesEach hex digit maps to four bits.
4. Read meaningApply it to sensors, registers, or packets.
Decimal
165
Hexadecimal
0xA5
Binary
1010 0101

Bit Visualizer

Bit 0 is the least significant bit on the right. Click any bit to inspect its place value.

8-bit word
GPIO register 0xA5 means bits 0, 2, 5, and 7 are HIGH. That is easier to see as binary 1010 0101.

Sensor Byte

0x7F is 127 unsigned. As an 8-bit signed value, it is still +127.

GPIO Register

0xA5 is 1010 0101, so pins 0, 2, 5, and 7 are HIGH.

MQTT Header

0x10 is the MQTT CONNECT fixed header byte: type 1 with flags 0.

Learning Support

Beginner Model

Binary uses base 2, decimal uses base 10, and hexadecimal uses base 16. They can all describe the same stored value.

Hex Shortcut

One hex digit equals one nibble, which is four bits. Two hex digits make one byte, so 0xA5 becomes 1010 0101.

Common Mistakes

  • Reading bit 0 from the left instead of the right.
  • Mixing signed and unsigned interpretations.
  • Forgetting that a fixed width controls overflow.
Quick Reference
Decimal Hex Binary Typical IoT Meaning
0 0x00 0000 0000 all flags off, null byte
16 0x10 0001 0000 MQTT CONNECT fixed header byte
127 0x7F 0111 1111 maximum signed 8-bit positive value
128 0x80 1000 0000 minimum signed 8-bit negative value
165 0xA5 1010 0101 alternating GPIO flags
255 0xFF 1111 1111 all 8-bit flags on, unsigned byte maximum
1023 0x03FF 0000 0011 1111 1111 10-bit ADC maximum count
4095 0x0FFF 0000 1111 1111 1111 12-bit ADC maximum count