Octal in Programming: When and Why Developers Use Base 8
Understand octal (base 8) in programming. Learn Unix file permissions, octal literals in C/Python/JS, and converting between octal and other bases.
Published:
Tags: developer-tools, number-systems, octal
Octal in Programming: When and Why Developers Use Base 8 Octal looks archaic at first glance — a base-8 number system using only digits 0 through 7. But it persists in modern development because of one dominant use case: Unix file permissions. Every developer working on Linux or macOS regularly encounters octal, often without recognizing it as such. This article explains octal arithmetic, where it appears in real code, and how to convert between octal and other bases. --- Octal Basics: Base 8 In base 8, valid digits are 0, 1, 2, 3, 4, 5, 6, 7. Position values are powers of 8: Counting in octal: 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, ... 17, 20, 21, ... Notice that after 7, you carry — there is no digit 8 or 9 in octal. in octal is 8 in decimal, not 10. This is a famous C gotcha (more on that…
All articles · theproductguy.in