OCT2BIN Function (LibreOffice Calc)
Learn the OCT2BIN function in LibreOffice Calc: Converts an octal number to a binary number.
Verification status: Selected examples were executed in LibreOffice Calc 25.2.3.2. This does not establish that every formula and edge case was tested. How formula examples are checked
Quick answer
OCT2BIN converts an octal number into binary text. For example, =OCT2BIN("3";3) returns 011; the optional Places argument pads the result with leading zeroes. The result is text, not a number, so retain it as text when writing device or bit-field codes.
LibreOffice syntax and arguments
=OCT2BIN(Number [; Places])
Number — Required. Octal string using digits 0–7, up to 10 octal digits; a text cell reference also works.
Places — Optional. Desired length of the positive binary output, adding leading zeros as needed. Omit for a minimal-width positive result.
Calc’s English-language Help writes argument separators as semicolons. The square brackets mean optional; do not enter the brackets literally. This function belongs to Calc’s Add-In / Analysis group in the 26.8 Help. There is no official introduction-version claim for this function in the consulted entry; it was also executed successfully in 25.2.3.2. Official syntax.
Worked data table: convert octal configuration values
Put the following codes into text-formatted A2:A5 and enter =OCT2BIN(A2;8) in B2. Copy B2 downward.
On a narrow screen, scroll this table sideways to see every column.
| Row | A: octal text | B: formula | Expected B: binary text |
|---|---|---|---|
| 2 | 144 |
=OCT2BIN(A2;8) |
01100100 |
| 3 | 17 |
=OCT2BIN(A3;8) |
00001111 |
| 4 | 7 |
=OCT2BIN(A4;8) |
00000111 |
| 5 | 0 |
=OCT2BIN(A5;8) |
00000000 |
Why row 2 works: octal 144 is decimal 100, whose binary form is 1100100 (seven characters). Requesting eight places adds exactly one leading zero. Without padding, =OCT2BIN("144") returns 1100100. Do not type the octal code as an eight-digit binary number: the arguments and output are in different bases.
All four table values can be checked independently using =OCT2DEC(A2) to display the decimal representation. Do not sum the binary text values directly as though they were decimal readings.
Advanced scenario: round-trip checks and signed status codes
A useful consistency check is =BIN2DEC(OCT2BIN("144")), which returns 100. This verifies the octal-to-binary representation of a positive value; it does not remove the function’s signed-width restrictions.
For signed inputs, Calc’s input uses a 30-bit two’s-complement octal code and the output uses a 10-bit two’s-complement binary code. The full-width octal code "7777777777" represents -1, and =OCT2BIN("7777777777") returns 1111111111. In the observed Calc version, supplying Places=2 for this negative input still returned the fixed ten-character form, rather than shortening it. Positive input "1000" represents 512, which is outside OCT2BIN’s positive 10-bit range and produced Err:502 in the native test.
Practical takeaway: This is not a general arbitrary-length binary encoder. For positive inputs, the supported output range is 0–511; signed negative results use ten-character binary. If you need longer unsigned bit patterns, choose a workflow designed for that width instead of assuming extra Places expands the numeric range.
Errors, unexpected results and fixes
On a narrow screen, scroll this table sideways to see every column.
| Symptom or formula | Result observed in Calc 25.2.3.2 | What to do |
|---|---|---|
=OCT2BIN("8";4) |
Err:502 | Replace invalid octal digits with a valid source value. |
=OCT2BIN("144";4) |
Err:502 | Binary 100 needs seven places; request 7 or more. |
=OCT2BIN("1000") |
Err:502 | Decimal 512 is outside the positive range for this function. |
=OCT2BIN("3";0) |
Err:502 | Use a positive Places value or omit it. |
=OCT2BIN("7777777777";2) |
1111111111 |
For negative signed values, Places did not shorten the output. |
For data imported as numbers, preserve leading zeros by formatting the source column as Text before data entry or import. Places controls output padding and does not fix input corruption. If you receive an error on an apparently valid value, check for whitespace, non-octal characters, length and the destination width.
Cross-software compatibility
Excel documents OCT2BIN(number, [places]) and 10-character signed behavior in Microsoft OCT2BIN documentation. English Excel examples use commas; English Calc uses semicolons. Error labels may differ: the native Calc invalid arguments listed above yielded Err:502, while Microsoft’s documentation discusses Excel’s #NUM! and #VALUE! categories. Excel, Google Sheets and other versions of Calc were not executed in the recorded checks.
Related Calc guides
Documentation evidence and native test status
- LibreOffice 26.8 Help — OCT2BIN, accessed 2026-10-11: syntax, octal input, optional Places and two’s-complement input.
- Microsoft Support — OCT2BIN, accessed 2026-10-11: Excel syntax, padding and range constraints; documentation-only cross-application comparison.
- Native evidence: Formula and expected results listed here were executed through UNO in LibreOffice Calc 25.2.3.2; other software and Help 26.8 were not run. See bundled
native-results.json, script and ODS workbook.
How this guide was checked
Selected example formulas were run in LibreOffice Calc 25.2.3.2 on Linux on October 12, 2026. The official Help may cover a newer version. Tests of selected formulas do not certify every locale, interactive array operation or file round trip. View the example-check record.