# What is an octet in networking?

We’re going to discuss what is an octet in networking. Before we dive into networking though, it will be helpful to first discuss the bit and the byte which is how we build our octets for networking.

## What’s a bit

First, let’s start with a bit. The bit is a 1 or a 0, it’s a very simple building block upon which we can build a whole system to store data. Did you wash the dishes? Yes or No should be the only responses. If my kids try to answer something in the middle, it doesn’t work. Clearly this is a simple data structure, it can’t get more basic than this.

## What’s a byte

A byte is represented by 8 bits, obviously more complex, but it composed of bits so it’s still simple. Using the bits correctly we can represent numbers. 1100 0011 represents 195 for example. It is also called an octet. It is a number that can represent 256 (2^8) different combinations. Notice that there is a power of 2 for every bit in the byte. Zero in bytes is 0000 0000. 255 is 1111 1111.

## Convert from bits to a number

In converting from bits to numbers you care about both it’s value and it’s position in the binary string. The position tells you what power of 2 to use (zero based) and the boolean indicates if it’s included at all. If 0, it’s not included, if 1 then it should be included. Example: 0000 0001 is 2^0  because the 1 is in the 0th position. Which equals 1. 0000 0011 is 2^0 + 2^1 which means 1 + 2 = 3. Notice that I’m working from the right (0th position) and adding the 2^(position) if it’s a 1, ignoring it if it’s a 0.  Another example: 0000 0100 means 2^2 = 4. Notice that for a shortcut I’m just leaving off all the 0’s because there is no point in adding them in. Hopefully you see the pattern here and could easily tell when a number is odd (when it ends with a 1).

## Octet in networking

An octet in networking refers to the 8 bytes of each piece of an IPV4 address. Obviously it can be between 0 and 255 and there are 4 of them.

In networking, an octet refers to one member of an IPV4 address. The address has the format XXX.XXX.XXX.XXX where XXX is an “octet” or a number that fits in 8 bits, meaning, 0-255. For example, the binary equivalent of 255 is 1111 1111 and 0 is 0000 0000. To make things more readable we put a space between the 4 bits in a byte. That’s because it’s easier to read and that’s called a nibble or a nybble.

## Take a nibble of the byte?

A nibble is really just a half of a byte. A half-byte, 4 bits, whatever. It’s basically a byte broken into 2 pieces and it sure makes it easier to read than just cramming all 8 bites into one long string.

## Summary

So as you can see it’s not too complex. A bit is a 0 or 1. An octet is a byte, (i.e. 8 bits grouped together) and will usually have a space between it’s 2 nibbles. An IPV4 address is simply 4 octets separated by a period.

This site uses Akismet to reduce spam. Learn how your comment data is processed.