3tej home
← Utilities

What is Hex / Binary / Decimal Converter?

A Hex / Binary / Decimal Converter converts data from one format to another using a deterministic mapping. It parses the input, transforms it according to the relevant standard, and returns a ready-to-use result. Convert between number bases instantly. The.

Hex / Binary / Decimal Converter

Convert between any two of: decimal, binary, hex, octal. Edit any field.

Edit any field

Bytes / Bits

8 bits

1 byte

Notes

4 bits = 1 hex digit (nibble)
8 bits = 2 hex digits = 1 byte
16 bits = 2 bytes (short)
32 bits = 4 bytes (int)

About this tool

The Hex/Binary Converter converts between decimal, binary, hexadecimal, and octal number systems. Enter a value in any base and see all four representations instantly.

About number bases

A base, or radix, is how many distinct digits a positional number system uses. Decimal (base 10) uses 0 to 9. Binary (base 2) uses only 0 and 1. Hexadecimal (base 16) uses 0 to 9 plus A to F. Octal (base 8) uses 0 to 7. The same quantity wears a different costume in each base. The byte value two hundred and fourteen is 214 in decimal, D6 in hex, 11010110 in binary, and 326 in octal. Same value, four spellings.

Computers run on binary because transistors have two stable states: off (0) and on (1). Humans cannot read long binary strings without losing count, so we use hex to read memory dumps, color codes (#FF6633), and MAC addresses. This converter bridges all four bases instantly so you do not have to do the arithmetic by hand.

How base conversion works

Every base uses the same positional logic. Each digit's value is the digit times the base raised to the position index (counting from the right, starting at zero).

Decimal value = sum of (digit_i x base^i) for i = 0 .. n
Binary  1101 = 1*8 + 1*4 + 0*2 + 1*1  = 13
Hex     D6   = 13*16 + 6*1            = 214
Octal   326  = 3*64 + 2*8 + 6*1       = 214
Bit count    = ceil(log2(value + 1))
  • Decimal to binary: divide by 2 repeatedly, read remainders bottom-up.
  • Binary to hex: group bits in nibbles of 4 from the right; map each nibble (0000 = 0, 1111 = F).
  • Hex to decimal: multiply each hex digit by 16 to the power of its position, sum.
  • Octal to binary: each octal digit expands to exactly 3 binary digits (5 = 101, 7 = 111).

Worked example

Convert the decimal value 255 across all four bases.

  1. Decimal: 255 (the maximum value of one unsigned byte).
  2. Binary: 255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 11111111. Eight ones.
  3. Hexadecimal: split 11111111 into two nibbles 1111 and 1111. Each is F. Result: FF.
  4. Octal: regroup the binary into 3-bit chunks from the right: 011 111 111 = 377.
  5. Bit count: ceil(log2(256)) = 8 bits, exactly one byte.
Result: 255 decimal = 11111111 binary = FF hex = 377 octal, occupying 8 bits or 1 byte. Type 255 into the decimal field above and watch the other three fields update instantly.

Common base size reference

BitsBytesUnsigned rangeHex rangeUse
40.5 (nibble)0 to 150 to FOne hex digit, BCD
810 to 25500 to FFByte, ASCII char, color channel
1620 to 65,5350000 to FFFFUnicode BMP code point, short int
2430 to 16,777,215000000 to FFFFFFRGB color (#RRGGBB), audio sample
3240 to 4,294,967,29500000000 to FFFFFFFFIPv4 address, int32, RGBA
4860 to ~2.8 x 10^1412 hex digitsMAC address
6480 to ~1.8 x 10^1916 hex digitsint64, timestamp nanoseconds

Common pitfalls

  • Hex case sensitivity. AF and af are the same value. Some parsers reject lowercase or mixed case, so normalise to uppercase before persisting.
  • Leading zeros in octal literals. In C, JavaScript, and Python 2, a leading zero (0755) means octal. Drop the zero and you change the value silently. Python 3 requires 0o755.
  • Sign extension. Casting a negative 8-bit value to 16 bits without sign extension turns -1 (0xFF) into 255 (0x00FF) instead of -1 (0xFFFF).
  • Overflow wrap-around. Adding 1 to 0xFF in an 8-bit register yields 0x00, not 0x100. The converter shows the actual stored value, not the mathematical one.
  • Binary string concatenation. Joining "101" + "010" gives "101010" (42), not the bitwise OR. Separate concatenation from arithmetic carefully.
  • Color hex shortcut. #F3A is shorthand for #FF33AA, expanding each digit by repeating it. The converter expects full hex, not CSS shorthand.

Related tools

Frequently asked questions

How do I convert decimal to binary by hand?

Repeatedly divide by 2 and read the remainders bottom-up. Example: 13 divided by 2 is 6 remainder 1; 6 divided by 2 is 3 remainder 0; 3 divided by 2 is 1 remainder 1; 1 divided by 2 is 0 remainder 1. Read upwards: 1101. That is 13 in binary, and it matches the converter on this page.

Why do programmers prefer hexadecimal over binary?

Hex is base 16, so every hex digit maps cleanly to exactly 4 binary digits (one nibble). The byte 11010110 becomes D6 in hex, which is much faster to read, dictate over the phone, and remember than the 8 ones and zeros. Hex appears in color codes (#FF6633), memory addresses (0x7FFFC000), and MAC addresses for the same reason.

What is the difference between unsigned and two's complement representation?

An unsigned 8-bit number stores 0 to 255. Two's complement uses the leading bit as a sign and stores -128 to 127 in the same 8 bits. Most CPUs use two's complement because addition and subtraction work identically for positive and negative values. This converter shows unsigned magnitudes; for negative values, calculate the two's complement separately.

How many bits do I need for a given decimal value?

Take the base-2 logarithm of the value and round up. ceil(log2(N+1)) bits suffice. 255 fits in 8 bits, 256 needs 9, 65535 fits in 16, and 4294967295 fills a full 32-bit register. The bit and byte counters on this page apply that formula in real time.

Why is octal still used and where does it appear?

Octal (base 8) groups three binary digits per octal digit. It is mostly legacy now, but it still shows up in Unix file permissions (chmod 755 means owner rwx, group rx, other rx) and in old PDP-11 documentation. Hex took over for most modern uses because 4-bit groups align with bytes more naturally than 3-bit groups.

Last updated 2026-05-28.

IT
India Tools Editorial
Calculators & explainers maintained by the India Tools team.