Octal Arithmetic

This article is part of a series, access the series index.

Calculating Octal

I’ve shown you how to perform the four functions of arithmetic using binary, the two most used operations in hexadecimal, so now we’ll cover octal briefly (as it’s not as widely used). I’m not really showing you anything you don’t already know, as with hexadecimal the difference lies only in the base.

Octal Addition

First off, to do addition in octal it helps for us to remember our number line:

With that number line it’s easy to see how octal addition works. For example, 5 + 5:

So 5 + 5 = 12; The above diagram illustrates that once the second 5 goes over the base, it wraps back around, setting the 8’s place as 1, and continues on to the number 2. Thus making the number 12 (10 in decimal). A in this case is what we would refer to as 10 in decimal. For a refresher on number bases refer to the binary article.

Here are some more example octal additions:

Hmmm… as you can see octal plays off a shortge of digits. After all 7, 8, and 9 are missing. When you get to the value 8 and above you ‘carry’. Observe:

Notice how it’s 16, and not 17. That’s exactly how 9 + 9 is equal to 18 in decimal, not 19. If you are having trouble wrapping your head around that, just think about for a moment, or lay two number lines out next to each other and count from one 7 to the next 7. Then things should make more sense.

Octal Subtraction

First off, to do subtraction in octal we shall once again remember our number line:

Now, we count backwards in our calculations:

But what about carrying? What if I subtract 1 from 10 in octal? You have to remember that 10 = 9 in octal. You do the same thing when carrying in decimal. You cross out a number, subtract one, and then add a ‘ten/eight’ (10) to the next placevalue. Here’s an example in hexadecimal:

10 (8) – 7 (7) = 1 (1) Pretty exciting huh? More exciting is how 21 – 7 = 12. Since 7 is greater than 1 we have to carry from the ‘eight’s’ place. We subtract 1 from 2, and add a ‘eight’ to the one’s place making it 11 (9 decimal). 11 – 7 is 2, to double check convert it to decimal 11 (9) – 7 (7) = 2 (2). Then we take down the modified eight’s place, a 1, and we get 12 (10).


For now, this should have you calculating octal ’til the cows come home. This is an important skill when calculating addresses in memory, which you’ll soon be doing in assembly. Memory locations are often referred to in hexadecimal in order to shorten their length. Hope this has helped you learn some more about computers!

If you appreciate my tutorials please help support me through my Patreon.

photo credit: nine times eight via photopin (license)


I'm just a wunk, trying to enjoy life. I am a cofounder of http//originalpursuitssoc.com/ and I like computers, code, creativity, and friends.

You may also like...

Leave a Reply

%d bloggers like this: