Format Code Now
/

Octal to Hex Converter

CU-05

Paste octal numbers, one per line, and press Octal to hex to get hexadecimal values. The second button converts hex back to octal.

Runs in your browser. Nothing is uploaded.

Numbers, one per line (octal for the first button, hexadecimal for the second)

Converted numbers

How to use it

  1. Type or paste octal numbers, one per line, using digits 0 to 7. Sample loads four.
  2. Press Octal to hex. The hexadecimal numbers appear in the output, one per line.
  3. To convert the other way, put hex numbers in the box and press Hex to octal.
  4. Tick the 0x prefix or uppercase option if you want them, then copy or download the result.

What the conversion does

Each octal number is read as a whole number and written back out in base 16. For example 377 in octal is 255 in decimal and ff in hex. The work is done with BigInt, so long numbers are exact, up to 20,000 digits. By hand you would write each octal digit as three bits, regroup the bits in fours from the right, and read each group as a hex digit.

A note on octal numbers like 755

A mode such as 755 or 0644 is usually seen in Unix file permissions. Here it is treated as an ordinary octal number, so 755 becomes 1ed in hex. The tool does not interpret permission bits, and it does not read a leading 0 as a marker; a leading zero is simply dropped from the result. Digits 8 and 9 are rejected, because they do not exist in octal.

Error messages and what to do

MessageWhat it meansFix
"789" is not a valid octal number: "8" is not an octal digit.An octal number only has digits 0 to 7.Fix the digit, or use the other button if the number is already hex.

Questions people ask

How do I convert octal to hex?

Paste the octal number and press Octal to hex. By hand, write each octal digit as three bits, regroup the bits in fours from the right, and read each group as a hex digit. So 377 is 011 111 111, then 0FF, which is ff.

What is octal 755 in hex?

Octal 755 is 1ed in hex, which is 493 in decimal. This page treats it as a plain number. For file permissions each digit is a separate group of read, write and execute bits, which this tool does not break out.

Can I also convert hex to octal on this page?

Yes. The second button converts hex numbers to octal. Digits can be upper or lower case, and a 0x prefix is accepted. Both directions share the same options for prefix, case and showing the input beside the result.

Why do I get an error for the digits 8 and 9?

Octal is base 8, so it only has the digits 0 to 7. An 8 or 9 means the number is not octal. The error names the first bad character so you can find it, and you can check the number is in the base you think.

Does the tool support negative numbers or fractions?

A leading minus sign is kept, so -17 in octal becomes -f in hex. Fractions are not supported: a number with a decimal point is rejected with an error, so nothing is silently rounded.

About this tool

It reads octal (digits 0 to 7) and writes the same value in hexadecimal, or the other way round with the second button. Octal such as 755 for file permissions is read as a number, not as permission bits. It converts whole numbers only, using BigInt, so a number with hundreds of digits is converted exactly. Put one number per line; spaces and underscores inside a number are ignored (so 1111 0000 is one number), a leading - or + is kept, and the prefix that matches the input base (0b, 0o or 0x) is allowed. Leading zeros are not kept in the result, because the value is converted, not the text. Fractions such as 1.5 are rejected with an error, and a digit outside the chosen base is rejected and named.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.