Octal Converter Free | Octal to Decimal, Binary, Hex

🔢 Math & Numbers Free Forever

Octal Converter: Octal, Binary, Decimal & Hex

Convert any number between octal, binary, decimal, and hexadecimal, instantly and precisely, with support for arbitrarily large integers.

Value
Input Base
About This Tool

How this octal converter works, and why Unix permissions still use base 8

Octal is base 8, built from the digits 0 through 7 only. It survives today mostly for one reason: three binary bits produce exactly eight possible values, 000 through 111, so octal maps onto binary almost as cleanly as hex does, just in groups of three bits instead of four. That is why a Unix file permission like 755 is octal rather than decimal, each digit represents exactly three permission bits, read, write, execute, for owner, group, and everyone else.

This tool converts a number between any of four bases, binary, octal, decimal, hexadecimal, using JavaScript’s BigInt type rather than ordinary numbers, so precision never degrades even on inputs with dozens of digits.

The conversion algorithm, generalized for any base

Rather than writing a separate function for every possible pair of bases, this tool converts through a single general purpose routine that reads a string in any base and produces a BigInt, then writes that BigInt back out in any target base.

Step 1 Validate the digit set Before anything else, the input is checked against a regular expression specific to the selected base, digits 0 through 7 only for octal, so a stray 8 or 9 is caught immediately rather than silently mishandled.
Step 2 Parse left to right using Horner’s method Each digit is converted to its numeric value, and the running total is multiplied by the base and added to the next digit as the string is scanned left to right. This is mathematically identical to the sum-of-powers method but requires no exponentiation.
Step 3 Convert the BigInt to the target base by repeated division To go the other way, the value is repeatedly divided by the target base. Each division’s remainder becomes one output digit, and the digits come out in reverse order, so they are collected and then flipped at the end.
// parsing any base into a BigInt using Horner’s method function parseInBase(str, base) { var b = BigInt(base); var result = 0n; for (var i = 0; i < str.length; i++) { var d = digits.indexOf(str[i].toLowerCase()); result = result * b + BigInt(d); } return result; } // writing a BigInt out in any target base via repeated division while (v > 0n) { var rem = v % b; out = digits[Number(rem)] + out; v = v / b; }
OctalBinary (3-bit groups)Decimal
71117
10001 0008
755111 101 101493
17001 11115
Worked example: chmod 755. Split 755 into its three digits, 7, 5, 5. Each maps to three binary bits: 7 is 111 (read, write, execute all on), 5 is 101 (read and execute, no write). So chmod 755 means the file owner gets full read, write, execute access, while the group and everyone else get read and execute only, no write. Run this through the tool and you get decimal 493, but the binary output, grouped in nibbles as 001 111 101 101, is what actually reveals the permission bits at a glance once you regroup it in threes instead of fours.

Where octal shows up beyond permissions

Legacy systems and old languages

Older systems including early Unix, PDP-11 assembly, and some embedded platforms used octal as the primary human-readable number format long before hex became dominant, since 8 fit their word sizes cleanly.

C-style leading-zero literals

In C, C++, and several other languages, a number literal written with a leading zero, like 017, is interpreted as octal rather than decimal, a quirk that has caused more than a few subtle bugs over the decades.

Arbitrary precision via BigInt Supports binary, octal, decimal, hex 3-bit to octal digit mapping
  • Octal covers the history of base 8 notation and its historical use in computing.
  • Unix numeric file permissions explains the chmod octal convention referenced in the example above.
  • MDN: BigInt documents the arbitrary precision integer type this tool relies on for exact conversion.

Where octal still survives

Working out a chmod permission value before running it on a server, reading legacy system documentation or old assembly listings that use octal notation, debugging a C program where a leading zero accidentally turned a decimal literal into octal, and cross checking octal escape sequences in string literals against their actual character codes. Anywhere permission bits or legacy numeric literals appear, this converter turns an opaque three digit code into something you can actually verify.

Common Questions

FAQ: Octal Converter

Octal (base 8) is most commonly seen today in Unix and Linux file permission notation, where a permission set like 755 or 644 is an octal number representing read, write, and execute bits for the owner, group, and others. It was also historically used as a compact way to represent binary machine code before hexadecimal became more standard.

Multiply each octal digit by 8 raised to its position power (counting from 0 on the right) and sum the results. For example, octal 755 equals 7×64 + 5×8 + 5×1 = 448 + 40 + 5 = 493 in decimal, which is exactly what this tool computes automatically.

Because 2³ equals 8, every possible 3-bit binary combination (000 through 111) corresponds to exactly one octal digit (0 through 7). This clean mapping is why octal was historically popular as a human-readable shorthand for binary, grouping bits in 3s instead of the 4s used for hexadecimal.

In Unix file permissions, each octal digit represents a permission triplet (read=4, write=2, execute=1) for owner, group, and others respectively. So chmod 755 breaks down as: 7 (4+2+1, read+write+execute) for the owner, 5 (4+1, read+execute) for the group, and 5 (4+1, read+execute) for everyone else.

Yes, this tool uses JavaScript’s BigInt type internally instead of standard floating-point numbers, which means it can accurately convert integers far beyond the ~9 quadrillion safe-integer limit that regular JavaScript numbers are restricted to, with no precision loss or rounding errors.

Each base only allows specific digits: binary allows just 0 and 1, octal allows 0 through 7, decimal allows 0 through 9, and hexadecimal allows 0 through 9 plus A through F. If your input contains a digit outside the allowed range for the base you selected (like an ‘8’ while Octal is selected), the tool flags it as invalid rather than silently producing a wrong answer.

Privacy Overview

Cookies let this site remember your preferences and show us which tools people actually use. Full detail sits in our Privacy Policy.