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

Octal to Hex

Turn an octal number into hexadecimal without a calculator. The working writes the octal digits as three-bit groups, joins them, and splits the bit string again into fours.

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

How to use Octal to Hex

  1. Enter octal numbers, one per line.
  2. Read the hex result and both groupings.
  3. Choose upper or lower case and a prefix.

Features

  • Three-bit and four-bit groupings shown together
  • No size limit
  • Fractions supported
  • Upper or lower case output
  • Accepts 0o prefixes
  • Decimal and binary shown as well

Supported formats

Input

  • Octal numbers
  • Typed or pasted numbers

You get

  • Hexadecimal
  • 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 Octal to Hex 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

Octal to hexadecimal: three bits in, four bits out

Older documents, assembly listings and some Unix utilities give numbers in octal, whereas debuggers and modern specifications prefer hexadecimal. Moving a constant from one to the other is a common chore, and a pocket calculator will often handle it only through decimal. This page uses the direct route through the bits and prints it.

The two-step method

First write every octal digit as three bits, using 0 → 000 up to 7 → 111, and join the results. Second, cut the bit string into groups of four, beginning at the binary point and moving outward, and pad the outermost group with zeros. Convert each group to a hex digit from 0 to F. No decimal arithmetic appears anywhere, so the method is both fast and exact.

Why the first digit looks small

Because three does not divide four, the outermost hex group often has fewer real bits than the others. A nine-bit octal number, for example, always gives a first hex digit of 0 or 1. The padding zeros are only there to complete the group; they carry no value. If you see an unexpected 1 at the start, count the bits of the original, and it will usually explain itself.

Options

Hexadecimal output can be upper or lower case; the prefix switch adds 0x, and digit grouping splits long answers into blocks. The octal input may start with 0o, and spaces and underscores are ignored. If you give several numbers on separate lines, each is converted and the working describes the first. A digit 8 or 9 is flagged with its position, which is a common sign that a value was already decimal.

Edge cases

Zeros at the left of the result are removed. Octal fractions are supported: 0.4 is 100 in bits and, padded to 1000, becomes 0.8 in hex. Negative numbers retain the sign without conversion to a complement. Extremely long values work normally, since the page uses big integers; this matters for 64-bit constants written in octal in some legacy listings, which a 53-bit float would round.

A worked example

The Sample button loads 755, the permission mode for a typical executable. The digits expand to 111, 101 and 101, giving 111101101, nine bits. Regrouped from the right in fours it becomes 0001 1110 1101, which reads 1, E and D, so the hexadecimal result is 1ED. In decimal the value is 493. If you try 777, the bits are 111111111 and the hex is 1FF, which is 511, the largest value nine bits can hold.

Limits

The result is a number, not a mode. Hex is rarely used for permissions, so the hexadecimal form of 755 is mainly a way to check an exercise. The page cannot tell you whether a constant was meant to be a signed value, and it does not enforce a word size. If a document uses a prefix style the page does not know, remove it before pasting, because only 0o, spaces and underscores are stripped automatically.

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

Frequently asked questions

Why can the first hex digit be 1 when the octal number is all 7s?

Because nine bits split into fours leave a single bit in front. Octal 777 is 111 111 111, and regrouped it is 1 1111 1111, so the first hex digit is just 1. The value is the largest nine-bit number, 511.

Is it safer to go through decimal instead?

It works but adds arithmetic and chances for error with long numbers. Going through bits is exact and quick, and it is the method most textbooks teach for powers-of-two bases.

What is octal 777 in hex?

1FF. 777 is 111 111 111, nine bits, and regrouped in fours from the right that is 1 1111 1111, which reads 1, F, F.

Can the leading hex digit be small?

Yes. The top group may have fewer than four bits; it is padded with zeros on the left, so a 9-bit number gives a first digit of 0 or 1.

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.