OCT2BIN in Excel: Decode Octal Fields Within the Binary Target Range
Convert octal strings to binary in Excel, verify three-bit groups and respect the narrower signed output interval when converting negative values.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: OCT2BIN(number,[places]) converts octal notation to binary. The target quantity must fit −512 through 511, even though the input’s signed octal format can represent a much larger interval.
Availability and version history
- Introduced: the first introduction version is not established by the reviewed official history.
- Availability: official help lists Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel 2024, Excel 2024 for Mac, Excel 2021, Excel 2021 for Mac, Excel 2019, Excel 2016.
- Checked: October 14, 2026; official OCT2BIN reference. Documentation and independent models; no native Excel execution or wider platform certification.
Syntax and documented endpoints
=OCT2BIN(number,[places])
The input permits up to ten octal characters and uses thirty-bit two’s complement. Microsoft states positive maximum 777 and negative minimum 7777777000 for this conversion. These represent 511 and −512.
Places is optional. Omission gives the minimum nonnegative output width; a larger count pads with zeros. Too few places produces #NUM!; fractional places is truncated, nonnumeric places produces #VALUE!, and negative places produces #NUM!. Invalid octal input produces #NUM!.
Negative quantities ignore places and produce ten binary characters. Zero places and the exact errors for every input-width or range violation are not separately established by the cited remarks. Use the documented valid interval instead of inferring a wraparound behavior.
Example 1: convert three-digit octal fields
Format A2:A6 as Text and enter these strings. Put =OCT2BIN(A2,9) in B2 and fill down.
Only the first table column is input data. The Decimal check column is explanatory and is not pasted into B; put calculated outputs in the worksheet cells specified above.
| Octal | Decimal check | Nine-position binary |
|---|---|---|
| 005 | 5 | 000000101 |
| 055 | 45 | 000101101 |
| 145 | 101 | 001100101 |
| 360 | 240 | 011110000 |
| 777 | 511 | 111111111 |
Each octal digit corresponds to three binary positions. For 145, the groups are 001, 100 and 101. For 360, the groups are 011, 110 and 000.
These positive illustrations make the conversion easy to inspect. The nine-character result 111111111 represents positive 511; a ten-character all-one binary input has a different signed meaning in BIN2DEC.
In C2 enter =OCT2DEC(A2) and in D2 enter =BIN2DEC(B2), then fill down. Both columns yield 5, 45, 101, 240 and 511.
Example 2: padding cannot expand the target interval
Octal 1000 represents decimal 512, which is outside OCT2BIN’s documented positive range. It is a valid input for OCT2DEC, but not an eligible positive quantity for this binary conversion.
A larger places argument does not change that range. A width request describes the presentation of a supported result; it does not select a different unsigned target type.
For the maximum positive input, =OCT2BIN("777",10) produces 0111111111. The leading zero makes the positive sign explicit in a ten-position field while preserving the value 511.
Advanced example: preserve negative quantities across widths
| Octal input | Signed quantity | Expected binary |
|---|---|---|
| 7777777777 | -1 | 1111111111 |
| 7777777775 | -3 | 1111111101 |
| 7777777000 | -512 | 1000000000 |
The input uses a thirty-bit negative encoding; the output uses ten bits. For −3, the unsigned encodings are 2^30−3 and 2^10−3. The quantity remains −3 despite the change in character count and base.
The last row is a documented Microsoft control. =OCT2BIN("7777777775",4) still produces ten binary characters because valid places is ignored for a negative value. It is not a request for a four-bit signed representation.
Contrast the short octal input 775, which is positive 509. With places 9 it becomes 111111101. Treating that short input as negative would import a different sign convention.
Advanced check: round-trip the representation deliberately
For the first table, =BIN2OCT(B2,3) reconstructs 005, 055, 145, 360 and 777. BIN2OCT uses the explicit three-position output width.
Without that requested width, a source 005 may return as 5. The numeric round-trip succeeds, but a character-for-character comparison fails because leading zeros are not part of the quantity. Preserve the original field or its intended width for exact file reconstruction.
For a second verification path, converting octal 145 to decimal 101 and then using =DEC2BIN(101,9) gives 001100101. DEC2BIN has the same signed numeric target interval but accepts a decimal quantity rather than octal notation.
Errors and remaining limits
=OCT2BIN("145",6) needs seven minimum binary characters and follows the documented insufficient-width #NUM! rule. Places 9.9 is truncated to 9 and gives 001100101. An input such as 128 contains an invalid octal digit and follows the documented invalid-input #NUM! rule.
Keep input cells as Text or use quoted constants to make the representation clear. Prefix handling, imported-text coercion and native error precedence were not executed; all examples use explicit valid digit strings or specifically documented invalid-digit controls.
References and verification
Expected outputs are independently calculated examples or documented rules, not captured native Excel results. Formulas use English function names and comma argument separators. Locale, rendering and boundary restrictions are stated where relevant.