0xCONVERTER-HEX

Guide

Hex vs Octal

Octal was there first. Then bytes became eight bits wide, and eight divides by four.

The whole argument in one fact

A byte is eight bits. Eight divides by four, giving two hex digits exactly. Eight does not divide by three, so an octal digit never lines up with a byte boundary.

one byte in hex     FF        two digits, exact
one byte in octal   377       three digits, and the first is
                              only using one of its three bits

That is the entire reason hex won. It is not fashion or convention — it is arithmetic, and it became decisive the moment hardware standardised on eight-bit bytes.

Side by side

OctalHexadecimal
Base816
Digits0–70–9, A–F
Bits per digit34
Digits per byte2.67 — does not divide2 — exact
Digits per 32-bit word10.678 — exact
Needs lettersNoYes
Aligns with12, 24 and 36-bit words8, 16, 32 and 64-bit words

Why octal existed in the first place

Octal was not a mistake. It was the right answer to a different hardware question.

Before eight-bit bytes became standard, machines used 12, 18, 24 and 36-bit words — all divisible by three. On a 36-bit machine, a word is exactly twelve octal digits, and octal is the natural shorthand. It also needs no letters, which mattered on the limited character sets and printers of the era.

The IBM System/360 in 1964 settled on the eight-bit byte, the industry followed, and the arithmetic changed sides.

Where octal still makes more sense

Octal survives wherever the underlying fields really are three bits wide, and Unix file permissions are exactly that.

chmod 755

  7 = 111  owner:  read, write, execute
  5 = 101  group:  read,        execute
  5 = 101  others: read,        execute

the same value in hex: 1ED  — which tells you nothing

Three permission groups, three bits each, three octal digits. The notation matches the structure exactly. Hex would split those fields across digit boundaries and make the whole thing unreadable, which is a neat demonstration that the best base depends entirely on the width of the thing you are describing.

The leading-zero trap

In C and the many languages that copied its syntax, a leading zero marks an octal literal. This is a genuine and long-standing source of bugs.

int a = 010;   // eight, not ten
int b = 08;    // compile error — 8 is not an octal digit
int c = 0x10;  // sixteen, unambiguously hex

Modern languages prefer an explicit 0o prefix for precisely this reason. Python 3, Rust and JavaScript all use 0o10, which cannot be misread.

Converting between them

There is no digit-level shortcut, because three and four do not divide into each other. Both go through binary.

  1. Expand each digit to its bit pattern — four bits for hex, three for octal.
  2. Join the bits into one string.
  3. Regroup from the right into the size the target base needs.
  4. Pad the leftmost group with zeros if it is short.
  5. Read each group as a digit in the new base.

The hex to octal converter and octal to hex converter do this for any length, and the reference table lists every byte.

Landmarks in both

DecimalOctalHexNote
777Octal's last single digit
8108Octal rolls over early
1517FHex's last single digit
6410040Octal's third position
255377FFOne byte — neat in hex, awkward in octal
5117771FFNeat in octal, awkward in hex
4,0957777FFFNeat in both — 12 bits divides by 3 and 4

The last row shows when the two do agree: every twelve bits, because twelve is the first number divisible by both three and four.

Frequently asked questions

Why is hexadecimal used more than octal?

Because a byte is eight bits. Eight divides by four, giving exactly two hex digits, but does not divide by three, so octal digits never align with byte boundaries.

Was octal ever standard?

Yes. Machines with 12, 18, 24 and 36-bit words divided evenly by three, so octal was the natural notation before eight-bit bytes became universal.

Where is octal still used?

Mainly Unix file permissions, where each digit holds read, write and execute as three bits. It also appears in some legacy systems and file formats.

What does a leading zero mean in a number?

In C and languages that copied it, an octal literal. So 010 is eight, not ten. Modern languages use an explicit 0o prefix instead.

Can I convert hex to octal directly?

Not digit by digit. Three bits and four bits do not divide into each other, so the conversion goes through binary or through the value itself.

What is FF in octal?

377. Both are 255 in decimal.