Skip to content

Octal to Hexadecimal Converter

Convert octal numbers to hexadecimal (base 16) instantly via a binary intermediate. Octal expands to 3-bit groups, which regroup into 4-bit hex digits.

Common Octal to Hex Values

100x8
170xF
200x10
1000x40
2000x80
3770xFF
4000x100
1777770xFFFF

How to Convert Octal to Hex

Octal digits are 3 bits and hex digits are 4 bits, so there is no direct digit mapping. Route the conversion through binary:

  1. Expand each octal digit to its 3-bit binary value
  2. Join the bits into one continuous binary string
  3. Regroup the bits into sets of four from the right, padding the left with zeros
  4. Convert each 4-bit group to a hex digit (0000=0 to 1111=F)

Example: Convert 377 (octal) to hex:

  • 3 → 011, 7 → 111, 7 → 111, giving 011111111
  • Regroup into 4s from the right: 1111 1111
  • 1111 = F, 1111 = F → FF (hex)

Code Examples

const octal = "377";
parseInt(octal, 8).toString(16); // "ff"

Frequently Asked Questions

How do I convert octal to hex?

Convert through binary: expand each octal digit to 3 bits, then regroup all the bits into sets of 4 from the right and map each group to a hex digit (0000=0 up to 1111=F).

Why can't I map octal digits straight to hex?

Octal uses 3 bits per digit and hex uses 4 bits per digit, so the digit boundaries do not line up. Regrouping the underlying bits in binary is the reliable method.

Can I use a 0o prefix?

Yes. Both plain octal like 377 and prefixed octal like 0o377 work. Only the digits 0 through 7 are valid octal input.

Related Tools