Hexadecimal Converter

Convert integers between decimal, binary, octal and hexadecimal. Choose the input base, enter a value, and the calculator returns the equivalents in all four bases at once — perfect for programming, networking and digital electronics.

Convert a number

Decimal: 0–9. Hex: 0–9 and A–F. Binary: only 0 and 1. Octal: 0–7. An optional "0x" prefix is allowed for hex.

Choose a base, enter a value, and press Convert.

The four common number bases

BaseNameDigitsExample (255)
2Binary0–111111111
8Octal0–7377
10Decimal0–9255
16Hexadecimal0–9, A–FFF

Hex digits correspond to 4 bits

Each hexadecimal digit represents exactly 4 binary bits. This is why hex is the standard shorthand for binary data: two hex characters represent one byte (8 bits). For example, FF = 1111 1111 = 255.

Conversion formula

decimal = Σ (digitᵢ × base^i)

Reading from the right and starting at position 0, multiply each digit by its base raised to the position, then sum. The reverse (decimal → any base) is done by repeated division with remainders.

Worked examples

Example 1 — Hex to decimal

FF₁₆ = ?

F = 15. 15 × 16¹ + 15 × 16⁰ = 240 + 15 = 255.

FF = 255

Example 2 — Decimal to hex

255 → hex. Divide repeatedly by 16: 255 ÷ 16 = 15 r 15 → 15 = F, 15 = F.

255 = FF

Example 3 — Binary to hex

Group bits in fours: 1011 0010 → B 2.

10110010₂ = B2₁₆ = 178₁₀

Frequently asked questions

Because one hex digit exactly represents 4 binary bits. This makes hex a compact, human-readable way of expressing binary data: a 32-bit value is only 8 hex characters. Colours, memory addresses, MAC addresses and hash digests all use hex.

No. Hex digits A–F can be upper or lower case. This converter accepts both and outputs upper case.

No. This converter handles unsigned integers only. Signed representations (like two's complement) are computed differently for each base width and are outside the scope of a general-purpose converter.