Home Tools Blog About

Convert Octal to Hex

In short

Convert octal to hex (and back) with BigInt precision, formatting options, Unix permission decode. Free, offline, client-side.

  • Runs in your browser
  • Nothing uploaded
  • Free, no sign-up

Convert octal numbers to hexadecimal and back, with BigInt-exact arithmetic. UPPERCASE or lowercase, with or without 0x prefix, bit-width padding (8/16/32/64/custom). Single 3-4 digit octals also decode as Unix file permissions (755 → rwxr-xr-x).

Enter value(s) (one per line).
🛡
100% PrivateNo server uploads, ever
InstantRuns in your browser
💧
No WatermarksClean output, always
🆓
Free ForeverNo accounts, no limits

How to Use Convert Octal to Hex

  1. Pick direction - Octal → Hex (default) or Hex → Octal. Swap ⇄ flips and pre-fills the previous result.
  2. Pick hex formatting. UPPERCASE renders digits A-F as capitals (the convention in addresses and hardware register dumps). Lowercase a-f is the C-source-code convention. 0x prefix on/off matches your destination syntax (C/C++/JS use 0x; some assemblers use $ or trailing h).
  3. Pick bit width - Compact gives the minimal hex (no leading zeros). 8/16/32/64-bit pad the binary and hex output so the value looks like a register dump. Custom lets you set any width up to 256 bits.
  4. Type your octal value(s). Default 755 is the famous Unix file mode → hex 0x1ED = decimal 493 = binary 111101101 = permission rwxr-xr-x. Multi-line input gets a row per value.
  5. Read the cross-reference columns. Octal, Hex, Decimal, Binary, Permission (for 3-4 digit octals). All BigInt-exact - no precision loss like parseInt-based tools have above 2^53.
  6. Permission panel - when input is exactly one 3-4 digit octal, a gradient panel appears below the table with the Unix permission decode (rwxr-xr-x format). Setuid (4)/setgid (2)/sticky (1) bits in 4-digit modes get the conventional s/S/t/T letter substitutions.
  7. Errors are isolated per row - invalid octal digits in one line don't kill the batch. Errors panel lists which lines failed.
  8. Copy or Download. Copy puts the full multi-line report on your clipboard. Download saves octal-hex-report.txt.

Frequently Asked Questions

Why use BigInt instead of parseInt(o, 8).toString(16)?

JavaScript’s regular Number type loses integer precision above 2^53 (about 16-17 decimal digits, or 18 octal digits). For values larger than that, parseInt‘s result rounds to the nearest representable float. This tool uses BigInt('0o' + clean).toString(16) which handles any size exactly. So a 60-octal-digit input gets its full 80-hex-digit result, not silently truncated.

What’s the UPPERCASE vs lowercase convention?

No semantic difference – hex is case-insensitive. Common conventions: UPPERCASE in datasheets, hardware register dumps, assembler addresses, color codes (#FF0000); lowercase in C/C++ source (0xff), most modern style guides, and CSS. Pick whichever your destination expects. Toggle the checkbox to see the result update live.

What does the 0x prefix do?

It’s a marker signaling “the following digits are hexadecimal, not decimal” – required syntax in C/C++/Java/JS source code (int x = 0xFF;). Some assemblers use $ instead ($FF), or a trailing h (FFh). Some shell contexts don’t want any prefix at all (raw hex pipe). Toggle the checkbox to match your destination.

Why does Octal → Hex go through decimal?

Mathematically it doesn’t have to – you could group octal digits in pairs of three bits and regroup into nibbles of four. But the BigInt implementation goes via the canonical numeric value: parse the octal string as a BigInt, then format that BigInt as hex. Same result, simpler code, exact precision.

What’s the Unix permission decode for?

3-digit octals like 755 and 4-digit like 04755 are commonly file permission modes from chmod. The decoder shows the ls -l-style rwxr-xr-x form. Each octal digit = a read/write/execute triplet: 7 = rwx, 6 = rw-, 5 = r-x, etc. The leading digit of a 4-digit mode controls setuid/setgid/sticky bits.

How big can the input be?

Unlimited (BigInt). A 100-digit octal becomes a ~83-digit hex value, computed exactly. Practical use is usually under 30 digits.

What’s the relationship between octal and hex?

Both are power-of-2 bases (8 = 2³, 16 = 2⁴), so both map cleanly to binary. Octal groups bits in triples; hex in nibbles. The choice between them is historical: octal was popular when computers used 12/24/36-bit words (which factor evenly into 3s). Hex won out with 8/16/32/64-bit byte-aligned systems because hex groups byte-aligned (2 hex digits = 1 byte).

Will the bit-width padding affect the permission decode?

No – the permission decode operates on the original octal string, not the padded hex/binary. 0755 with bit width 32 still decodes as rwxr-xr-x, even though the displayed binary is 00000000000000000000000111101101 (padded).

Is my data uploaded?

No. All BigInt parsing, formatting, and permission decoding run in your browser. Open DevTools → Network and confirm zero requests fire after the page loads – even when you Convert.

Does it work offline?

Yes. Total bundle is under 22 KB. Once loaded, disconnect and keep converting. Useful for embedded-system permission audits or assembler work without internet.

Keep going

Related Tools

All Hex tools →
Share

Embed this tool

Add this free tool to your website. Copy and paste the code: