Calcometry

Binary & Hex Converter

By using our calculators, you agree to our Terms of Use.

Whole-number decimal to binary and hex — useful for programming and electronics.

Decimal input

Whole numbers only — converts to binary and hexadecimal.

Binary

11111111

Hex: 0xFF

Hexadecimal
0xFF
Decimal
255

Related calculators

Number bases

Decimal (base 10) is everyday counting. Binary (base 2) uses only 0 and 1 — the native language of digital logic. Hexadecimal (base 16) uses 0–9 and A–F — a compact way to write binary nibbles in programming and electronics.

To convert decimal to binary, repeatedly divide by 2 and read remainders bottom-up. Hex groups four binary bits per digit — e.g., 255 decimal is 11111111 binary or FF hex.

Example: decimal 42 is 101010 in binary and 2A in hex. This tool handles whole numbers only — fractions require separate methods.

One hex digit always represents exactly four binary bits — that is why memory dumps and color codes use hex. Byte boundaries align on two hex digits (00–FF), which equals 0–255 decimal for 8-bit values.

Microcontrollers and FPGA registers are often documented in hex addresses even though the silicon stores bits. Converting between bases is the first step when reading datasheets or UART debug output.

Worked example: decimal 42 → binary 101010 (32+8+2) → hex 2A. The reverse path groups binary into nibbles from the right: 101010 → 0010 1010 → 2A.

Bit masks in firmware often use hex because each nibble maps cleanly to four bits. Setting bit 5 in an 8-bit register (0010 0000 binary) is faster to read as 0x20 hex than counting binary digits during a code review or JTAG debug session. Firmware bit masks read faster as 0x20 than counting five binary digits during JTAG bring-up on an 8-bit status register.

Web color codes (#RRGGBB) are hex byte pairs: #2A2A2A is RGB 42, 42, 42 decimal. Graphic designers and CSS authors convert channel decimals to two hex digits per channel — the same base-16 grouping this tool uses for whole integers. CSS color #2A2A2A maps RGB channels of 42 decimal — the same whole-number conversion this tool prints for programming and design handoff.

Memory addresses on 32-bit systems are frequently documented in hex (0x00400000) while bus widths are binary. Decimal 255 fits in one byte (11111111 binary, FF hex) — a recurring ceiling for unsigned 8-bit counters and PWM duty registers. Unsigned 8-bit counters roll over at 255 decimal (FF hex) — plan PWM duty and EEPROM addresses with that byte ceiling in mind.

Common questions

Why do programmers use hex?

One hex digit maps to exactly four binary bits, making long bit strings easier to read. Memory addresses and color codes (#FF5733) commonly use hex.

Does this support negative numbers?

Enter positive integers only. Signed binary uses two's complement — a different representation not covered here.

How do I convert hex back to decimal?

Multiply each hex digit by 16 raised to its place value and sum. A=10, B=11, … F=15. FF hex = 15×16 + 15 = 255 decimal.