Hex to Octal Converter
CU-04Paste hexadecimal numbers, one per line, and press Hex to octal to get base 8 values. The second button turns octal back into hex.
Runs in your browser. Nothing is uploaded.
Numbers, one per line (hexadecimal for the first button, octal for the second)
Converted numbers
How to use it
- Type or paste hex numbers, one per line. A 0x prefix is fine. Sample loads four, including a 32-digit one.
- Press Hex to octal. The octal results appear, one per line, in the same order.
- For the reverse, put octal numbers in the box and press Octal to hex.
- Use the options for a prefix, uppercase letters or to show each input beside its result, then copy the output.
How hex becomes octal
Hex uses 4 bits per digit and octal uses 3, so the two do not line up digit by digit. The usual manual route goes through binary: write each hex digit as 4 bits, regroup the bits in threes from the right, and read each group as an octal digit. FF is 11111111, regrouped as 011 111 111, which is 377. This tool does the same thing on the number itself with BigInt, so there is no size limit short of 20,000 digits.
Input rules
One number per line. Letters can be upper or lower case, an optional 0x prefix is accepted, and spaces or underscores inside a number are ignored. A leading minus sign is kept. Leading zeros are not kept, since the value is converted and not the text. Anything that is not a hex digit is rejected with the offending character named, and a fraction such as 1.8 gives its own error because only whole numbers are converted.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
"xyz" is not a valid hexadecimal number: "x" is not a hexadecimal digit. | The text has a character outside 0-9 and a-f. | Use only 0-9 and a-f. A leading 0x is the only prefix allowed. |
Questions people ask
How do I convert hex to octal?
Paste the hex number and press Hex to octal. By hand, convert each hex digit to four bits, regroup the bits in threes from the right, and read each group as an octal digit. So FF becomes 11111111, then 377.
What is 0xFF in octal?
0xFF is 377 in octal. It is 255 in decimal and 11111111 in binary. You can check it by pasting FF into the box and pressing Hex to octal, which returns 377.
Can I convert octal back to hex here?
Yes. Put octal numbers in the box and press Octal to hex. Digits must be 0 to 7. The result is lowercase hex by default, and you can tick the uppercase option to get capital letters.
Does it handle very long hex values like hashes?
Yes, within 20,000 digits per number. The conversion uses BigInt, so a 64-digit hex string converts exactly and does not lose low digits. Remember that this converts the number, not the bytes, so leading zeros are dropped.
Why are leading zeros missing from the result?
The tool converts the value of the number, and a value has no leading zeros. 000FF becomes 377, not 000377. If you need fixed width output, pad the result with zeros yourself to the width you need.
About this tool
It reads hexadecimal (0-9 and a-f, any case) and writes the same value in octal, or the other way round with the second button. 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.