1. Home
  2. Developer tools
  3. Hex to Octal

Hex to Octal

Hex and octal do not line up digit for digit, so the reliable method goes through binary. The working expands each hex digit to four bits, then regroups the bits into threes for octal.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use Hex to Octal

  1. Paste hex numbers, one per line.
  2. Read the octal result and both bit groupings.
  3. Copy it, with an optional 0o prefix.

Features

  • Shows the four-bit and three-bit groupings of the same bits
  • Exact for any length
  • Accepts 0x and upper or lower case
  • Fractions convert as well
  • Decimal and binary shown too
  • Names invalid characters

Supported formats

Input

  • Hex numbers
  • Typed or pasted numbers

You get

  • Octal
  • Two bit groupings

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the Hex to Octal is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Numbers are read in the base named by the tool, so a digit outside that base is reported instead of guessed.
  • Prefixes and separators (0x, 0b, 0o, spaces, underscores) are accepted, but letters and symbols outside the base are errors.

Guide

Hex to octal by regrouping bits

Converting between two bases that are both powers of two sounds like it should be easy, and it is, but only through the right middle step. Hexadecimal groups bits in fours and octal groups them in threes, so there is no digit-for-digit rule between them. The reliable method is to go through the bits, and this page shows that route explicitly.

Step one: expand to bits

Write each hexadecimal digit as four bits. The digit F is 1111, 4 is 0100, A is 1010 and so on. Join the groups to get the full bit string of the number. This stage is lossless because both representations describe the same bits.

Step two: regroup into threes

Starting from the binary point and moving outward, cut the string into groups of three. If the first group on the left is short, pad it on the left with zeros; if the last group after the point is short, pad it on the right. Each group of three is an octal digit from 0 to 7. The working on this page prints the regrouped bits and the digit for each, which also shows exactly where padding happened.

Why the groups drift

Since 4 and 3 share no factor, the borders of the hex groups and of the octal groups only coincide every 12 bits. That is why a hex value like FF, eight bits, turns into 377, where the leftmost octal digit is only two bits wide, and why you cannot simply read an octal digit off one hex digit. The picture on the page, with both rows of groups, makes the drift visible.

Options

Choose a 0o prefix on the octal result, and group the digits of long answers. Hex input can be upper or lower case, may have a 0x prefix, and may contain spaces or underscores. You can enter a list, one number per line; the working shows the first line. The box underneath gives decimal, binary and base 36 for the same number.

A worked example

The Sample button loads 1F4A.8. As bits, 1 is 0001, F is 1111, 4 is 0100 and A is 1010, and after the point 8 is 1000. Regrouped from the point: the integer bits, with leading zeros dropped, are 1 1111 0100 1010 and are padded to 001 111 101 001 010; the fraction bits 1000 are padded to 100 000, which is read as 4 and 0, and the trailing zero is removed. The digits are 1, 7, 5, 1, 2 and then .4, so the octal number is 17512.4. In decimal it is 8010.5, matching the hex-to-decimal page.

Limits

The page changes the representation, not the meaning. It does not know whether the value is an address, a colour or a mask, and it does not wrap values to a word size. For an exercise you may need to show the working in a particular style; use the lines on the page as a model and rewrite them in your own words. If you only need to check a conversion, the decimal figure in the comparison box is a quick sanity test.

Checked against the current version of the Hex to Octal on .

Frequently asked questions

Why is there no shortcut from one hex digit to octal digits?

Four bits do not divide evenly into threes. One hex digit spans one and a third octal digits, so the boundaries drift. After 12 bits, which is three hex digits and four octal digits, the groups line up again.

Does the result keep the same number of significant bits?

Yes, apart from zeros added at the outer ends to complete a group. Those zeros do not change the value, but they can make the leading octal digit smaller than 7.

Why not convert hex to octal directly?

16 is 2^4 and 8 is 2^3, so one hex digit is 4 bits and one octal digit is 3 bits. The groups never line up, and binary is the common ground.

What is 0xFF in octal?

377. FF is 1111 1111; regrouped from the right in threes that is 11 111 111, which reads 3, 7, 7.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.