www.steves-internet-guide.com Open in urlscan Pro
217.160.0.107  Public Scan

URL: http://www.steves-internet-guide.com/binary-numbers-explained/
Submission: On November 16 via manual from US — Scanned from DE

Form analysis 4 forms found in the DOM

POST http://www.steves-internet-guide.com/wp-comments-post.php

<form action="http://www.steves-internet-guide.com/wp-comments-post.php" method="post" id="commentform" class="comment-form" novalidate="">
  <p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> <span class="required-field-message">Required fields are marked <span class="required">*</span></span></p>
  <p class="comment-form-comment"><label for="comment">Comment <span class="required">*</span></label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required=""></textarea></p>
  <p class="comment-form-author"><label for="author">Name <span class="required">*</span></label> <input id="author" name="author" type="text" value="" size="30" maxlength="245" autocomplete="name" required=""></p>
  <p class="comment-form-email"><label for="email">Email <span class="required">*</span></label> <input id="email" name="email" type="email" value="" size="30" maxlength="100" aria-describedby="email-notes" autocomplete="email" required=""></p>
  <p class="comment-form-url"><label for="url">Website</label> <input id="url" name="url" type="url" value="" size="30" maxlength="200" autocomplete="url"></p>
  <p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Post Comment"> <input type="hidden" name="comment_post_ID" value="4680" id="comment_post_ID">
    <input type="hidden" name="comment_parent" id="comment_parent" value="0">
  </p><!-- Anti-spam plugin wordpress.org/plugins/anti-spam/ -->
  <div class="wantispam-required-fields wantispam-form-processed"><input type="hidden" name="wantispam_t" class="wantispam-control wantispam-control-t" value="1700102470">
    <div class="wantispam-group wantispam-group-q" style="clear: both; display: none;">
      <label>Current ye@r <span class="required">*</span></label>
      <input type="hidden" name="wantispam_a" class="wantispam-control wantispam-control-a" value="2023">
      <input type="text" name="wantispam_q" class="wantispam-control wantispam-control-q" value="7.3.5" autocomplete="off">
    </div>
    <div class="wantispam-group wantispam-group-e" style="display: none;">
      <label>Leave this field empty</label>
      <input type="text" name="wantispam_e_email_url_website" class="wantispam-control wantispam-control-e" value="" autocomplete="off">
    </div>
    <input type="hidden" name="wantispam_d" class="wantispam-control wantispam-control-d" value="2023">
  </div><!--\End Anti-spam plugin -->
</form>

POST /index.php

<form id="polls_form_49" class="wp-polls-form" action="/index.php" method="post">
  <p style="display: none;"><input type="hidden" id="poll_49_nonce" name="wp-polls-nonce" value="5b8516abe9"></p>
  <p style="display: none;"><input type="hidden" name="poll_id" value="49"></p>
  <p style="display: none;"><input type="hidden" id="poll_multiple_ans_49" name="poll_multiple_ans_49" value="1"></p>
  <p style="text-align: center;"><strong>Wnat protocol version are you using?</strong></p>
  <div id="polls-49-ans" class="wp-polls-ans">
    <ul class="wp-polls-ul">
      <li><input type="checkbox" id="poll-answer-168" name="poll_49" value="168"> <label for="poll-answer-168">MQTTv5</label></li>
      <li><input type="checkbox" id="poll-answer-169" name="poll_49" value="169"> <label for="poll-answer-169">MQTTv3.11</label></li>
      <li><input type="checkbox" id="poll-answer-170" name="poll_49" value="170"> <label for="poll-answer-170">MQTT-SN</label></li>
    </ul>
    <p style="text-align: center;"><input type="button" name="vote" value="   Vote   " class="Buttons" onclick="poll_vote(49);"></p>
    <p style="text-align: center;"><a href="#ViewPollResults" onclick="poll_result(49); return false;" title="View Results Of This Poll">View Results</a></p>
  </div>
</form>

POST /binary-numbers-explained/#es_form_f1-n1

<form action="/binary-numbers-explained/#es_form_f1-n1" method="post" class="es_subscription_form es_shortcode_form  es_ajax_subscription_form" id="es_subscription_form_6555814647ecc" data-source="ig-es" data-form-id="1">
  <div class="es-field-wrap"><label><br><input type="text" name="esfpx_name" class="ig_es_form_field_name" placeholder="" value="" required="required"></label></div>
  <div class="es-field-wrap"><label><input class="es_required_field es_txt_email ig_es_form_field_email" type="email" name="esfpx_email" value="" placeholder="" required="required"></label></div><input type="hidden" name="esfpx_lists[]"
    value="250017243c83"><input type="hidden" name="esfpx_form_id" value="1"><input type="hidden" name="es" value="subscribe">
  <input type="hidden" name="esfpx_es_form_identifier" value="f1-n1">
  <input type="hidden" name="esfpx_es_email_page" value="4680">
  <input type="hidden" name="esfpx_es_email_page_url" value="http://www.steves-internet-guide.com/binary-numbers-explained/">
  <input type="hidden" name="esfpx_status" value="Unconfirmed">
  <input type="hidden" name="esfpx_es-subscribe" id="es-subscribe-6555814647ecc" value="88c63e0d47">
  <label style="position:absolute;top:-99999px;left:-99999px;z-index:-99;" aria-hidden="true"><span hidden="">Please leave this field empty.</span><input type="email" name="esfpx_es_hp_email" class="es_required_field" tabindex="-1" autocomplete="-1"
      value=""></label><input type="submit" name="submit" class="es_subscription_form_submit es_submit_button es_textbox_button" id="es_subscription_form_submit_6555814647ecc" value="Join me Up"><span class="es_spinner_image" id="spinner-image"><img
      src="http://www.steves-internet-guide.com/wp-content/plugins/email-subscribers/lite/public/images/spinner.gif" alt="Loading"></span>
</form>

GET http://www.steves-internet-guide.com/

<form role="search" method="get" class="search-form" action="http://www.steves-internet-guide.com/">
  <label>
    <span class="screen-reader-text">Search for:</span>
    <input type="search" class="search-field" placeholder="Search …" value="" name="s" title="Search for:">
  </label>
  <button type="submit" class="search-submit">
    <span class="genericon-search"></span>
    <span class="screen-reader-text">Search</span>
  </button>
</form>

Text Content

Skip to content


Navigation
 * Home
 * MQTT Expand child menu
   * MQTT Course
   * MQTT-SN
   * MQTTv5
 * MQTT Python Expand child menu
   * MQTT – Python Course
 * MQTT Brokers Expand child menu
   * Mosquitto
   * MQTT Broker Testing Tools
   * Monitoring MQTT Brokers
 * Ask Steve
 * Projects
 * Buy Me A Coffee

Updated:September 16, 2023 By steve


BINARY NUMBERS EXPLAINED – BEGINNERS GUIDE

In my experience of teaching networking many students struggle with IP addresses
because they lack an basic understanding of binary numbers.

An understanding of binary numbers,the binary system, and how to convert between
binary and decimal is essential for anyone involved in computers, coding, and
networking.


BINARY 101 –  WHAT YOU WILL LEARN

 * The Basics of Number Bases -Base 10, Base 2 and Base 16
 * How to convert binary to decimal and vice versa
 * How to convert binary numbers to Hexadecimal and vice versa,
 * How to convert Hexadecimal to decimal and vice versa,


OVERVIEW OF BASE 10 SYSTEM OR DECIMAL NUMBERS

Before we learn about the binary number system we will look in more detail at
our normal decimal numbering system.

The principals are the same for all numbering systems, and they are easier to
learn using a system that you are more familiar with.

Firstly our decimal system uses 10 as a base and the numbers range from 0 to 9

Let’s look at a few example numbers

We start with the three digit number 129 (one hundred and twenty nine).

This made up of 100 +20 +9 =129

If we look at the diagram below we see that as we move from right to left the
columns increase by a factor of 10.

The 2 in the second column isn’t 2 but is 2*10=20 and the 1 in the third column
isn’t 1 but 1*10*10=100.



means 10 raised to the power of 0. This is equal to 1 and represents our units
column.

The short table below shows a few more entries using the power notation.



When writing decimal numbers we rarely write column values above the numbers as
we already know what they are so we simply write:

129 and not

I have introduced the power notation because it is fundamental to understanding
binary numbers.

The minimum number possible with three digits is 000 and the maximum is 999. For
numbers larger than 999 we need a 4th column which with be the 1000s column.


THE BINARY NUMBER SYSTEM

Binary numbers are base 2 numbers, and have only two values – 0 and 1.

If we look at a binary number like 101, then we can again assign column values
as we did with our decimal number, but this time we use 2, and not 10 as the
base.

So binary 101 binary has 1 in the units column,0 in the 2s column and 1 in the
4s column.

Again if we work our way from right to left then:

The 1 is a 1 as it is in the units column but the next 1 is not 1 but 1*4=4



Binary numbers use base 2 and so the columns are




BINARY TO DECIMAL CONVERSION

Let’s look at a few binary numbers and convert them to decimal

We start with the three digit binary number 101 (see image above

The number can be converted to decimal by multiplying out as follows:

1*1 + 0*2 + 1*4 = 5

The maximum value we can have with three binary digits is 111 = decimal 7
calculated as follows-

1*1 + 1*2 + 1*4


MORE EXAMPLES:

1011 binary = 1*1+1*2+0*4+1*8=11

1111 binary = 1*1+1*2+1*4+1*8=15


TRY IT YOURSELF

1001 binary = ?

1100 binary = ?


CONVERTING FROM DECIMAL TO BINARY

How do you convert a decimal number to a binary number.

Example what is decimal 10 in binary.

The way I do it is by using the following list of 2 multiples.

128,64,32,16,8,4,2,1

Here’s an handy chart



Note: error in diagram above should be 27=128

The procedure is to subtract the number with largest power of two from the
decimal number

The largest power of two number that we can subtract is 8 which is 23.

So 10-8 =2

we now do the same with the remainder so the largest number we can subtract is 2
which is =21

2-2=0

so we have 1 eight , No fours, 1 two, No units = 1010 = 23+ 21.

Example 2: Decimal 13 to binary code

1 eight , 1 four, 0 two, 1 units = 1101.

Example 3: Decimal 7 to binary code

0 eight , 1 four, 1 two, 1 units = 0111.

Answers to try it yourself questions

1001 binary = 9

1100 binary = 12


BYTES AND OCTETS AND HEXADECIMAL NUMBERS

In computers, coding and networking 8 bit numbers are common.

An 8 bit number is known as an octet, and also more commonly it is called a
byte. See Wiki for details.


BINARY TO DECIMAL AND DECIMAL TO BINARY CONVERSION 8 BIT NUMBERS

An 8 bit binary number can represent a maximum of decimal 255= binary 11111111.

Calculated as follows:

1*128 +1*64+1*32+1*16+1*8+1*4+1*2+1= decimal 255

Here is another 8 bit binary number –01101011.

To convert it to decimal we write the number with the column numbers above, as
follows:




Note: Error in image above should be 2 power 2 and not 3.

if we convert our columns to decimal equivalents using the following chart.



then the binary number 01101011 = 1*1 +1*2+0*4+1*8+0*16+1*32+1*64+0*128

=64+32+8+2+1= 107

Notice it consists purely of 1’s and 0’s.

To convert this number into decimal we need to understand what each 1
represents.

If we write the column values above the numbers then it becomes easy to convert
the binary number to decimal.

DECIMAL TO BINARY CONVERSION EXAMPLE

A final larger example convert decimal 200 to binary code

200=128+64+8=27+ 26+ 23 =11001000

Once you are happy with the process then you can use a binary to decimal
calculator like the one on windows.

This converts binary numbers to decimal



and this converts decimal numbers to binary




UNDERSTANDING HEXADECIMAL NUMBERS

A hexadecimal number (base 16) requires 4 bits and and has a maximum value of
15. It uses the symbols 0-9,A,B,C,D,E,F.

They are represented in binary form as follows:

0000=0
0001=1
0010=2
0011=3
0100=4
..
1010=A
1011=B
1100=C
1101=D
1110=E
1111=F

A byte (8 bits) can be represented as two hexadecimal numbers.

so

FF=binary 11111111 and decimal 255

F0=11110000 binary and decimal 240

 


VIDEO

I produced a video that covers the above if you prefer videos- Understanding
Binary numbers video

Was This Useful?



WORKBOOK

This tutorial is available in pdf format as a workbook and includes more
examples. There is a feedback page included with the download were you can
comment and request additional help if required.



Resources and Related Articles:

 * Good video on binary numbers and conversion
 * IPv4 Address classes
 * IPv 4 subnetting and Subnet Masks for Beginners
 * IPv4 subnetting worked examples
 * IPv6 Explained for Beginners
 * Beginners Guide to Data and Character Encoding
 * JSON Basics For Beginners-With Examples and Exercises

Please rate? And use Comments to let me know more


Networking


29 COMMENTS

 1.  Tim says:
     September 14, 2023 at 11:39 pm
     
     I believe in more examples he says do the 1011 binary = 1*1+1*2+0*4+1*8=11
     is wrong I believe it should be
     1*1+0*2+1*4+1*8=13
     
     Reply
     1. steve says:
        September 15, 2023 at 7:39 am
        
        Hi
        The answer is correct there are no 4s.
        Rgds
        Steve
        
        Reply
        1. T says:
           September 15, 2023 at 2:28 pm
           
           My mistake I figured out where I went wrong also another question
           under 8 bit numbers is the 2^3 in the right place on the 01101011?
           
           Reply
           
        2. T says:
           September 15, 2023 at 2:29 pm
           
           Just looks like the 2^3 should have been 2^2
           
           Reply
           1. steve says:
              September 16, 2023 at 8:37 am
              
              Tks
              Well spotted
              Rgds
              Steve
              
              Reply
              
           
        
     
 2.  loren says:
     August 16, 2023 at 8:15 pm
     
     Thanks! Appreciate it! need much more help & will get your workbook in
     future.
     
     Reply
     
 3.  Carl says:
     July 24, 2023 at 9:10 pm
     
     Man this helped a ton! If you read it slowly and try the examples it will
     bring everything together.
     
     Reply
     
 4.  USER says:
     July 14, 2023 at 11:53 am
     
     I have now understood the binary topic, thank you very much!
     
     Reply
     
 5.  Gracie says:
     April 24, 2023 at 10:24 pm
     
     Thanks so much, it helped me a lot. I almost gave up on the course. I have
     a question though, how do I know the binary numbers in letters e.g the
     world hello. How can I come up with the numbers
     
     Reply
     1. steve says:
        April 25, 2023 at 12:45 pm
        
        All of the alphabet uses the ascii code so if you look at an ascii table
        you should see the binary for each letter
        https://www.ascii-code.com/
        rgds
        steve
        
        Reply
        
     
 6.  Steve Hall says:
     April 5, 2023 at 10:47 pm
     
     54 years old Freshman. Currently enrolled at Northwest Louisiana technical
     Community College.
     Instrumentation & Electrical Technology. Just wanted say appreciate the
     information found on this site.
     
     Reply
     
 7.  Italo says:
     January 24, 2023 at 1:14 pm
     
     You added an extra 1 at the end of this expression 1*128
     +1*64+1*32+1*16+1*8+1*4+1*2+1+1. Or am I wrong?
     
     Also, in this expression 1*1 +1*2+0*4=1*8+0*16=1*32+1*64+0*128, I guess the
     equals (=) are incorrected. They have to be a plus sign (+), don’t they?
     
     Reply
     1. steve says:
        January 27, 2023 at 7:06 pm
        
        Tks for pointing out those mistakes I have corrected the tutorial.
        Rgds
        Steve
        
        Reply
        
     
 8.  James says:
     November 15, 2022 at 2:30 pm
     
     Thanks for putting this together Steve. I found this very useful.
     
     Reply
     
 9.  Josh says:
     September 21, 2022 at 4:57 am
     
     Struggling to figure binary numbers out for my Networking class and am
     about to just give up and take an F. Which will, in turn, cast serious
     doubts on whether or not I’m meant to be an IT major. This came natural to
     most of the other students. All except for me with my number dyslexia
     issues and difficulties with math in general, that is….. Thanks for trying
     to help some of us figure this enigma out though.
     
     Reply
     1. steve says:
        September 23, 2022 at 9:07 am
        
        No problem hope you managed to grasp it.
        Rgds
        Steve
        
        Reply
        
     
 10. TURNER says:
     May 18, 2022 at 6:53 pm
     
     this is cool
     
     Reply
     
 11. Keith Harding says:
     April 4, 2022 at 2:33 am
     
     How do you work out decimal 1961 to binary
     
     Reply
     1. steve says:
        April 5, 2022 at 11:54 am
        
        Start with subtracting 1024 then 512 then 256 etc
        rgds
        steve
        
        Reply
        
     
 12. D says:
     November 18, 2021 at 2:40 am
     
     Does not make any sense at all.
     
     Reply
     1. Lee says:
        February 12, 2022 at 10:41 pm
        
        Thank god im not the only one ! .. i wanted it explained in a way my
        ADHD , OCD and Autistic head could understand , Like Explain why it is
        what it is …
        
        Reply
        1. Ransh says:
           July 29, 2022 at 3:53 am
           
           Since for conversion of decimal to binary highest power of 2 is
           subtracted….So in this case highest power that can be subtracted is
           2^(10) which is 1024 near to 1096…that’s why sir directly wrote
           1024….and 2^9 is 512 , 2^8 256..that’s why sir showed u the process…
           what number to subtract…
           
           Reply
           
        
     
 13. Bhargav says:
     October 31, 2021 at 5:29 pm
     
     Thankyou very much sir…. I’m beyond happy.
     
     Reply
     
 14. olivier ged says:
     October 25, 2021 at 10:55 pm
     
     thanks.
     Question 8 should be:
     
     What is FE in decimal.
     
     Currently asked what it is in Binary, with decimals answers.
     
     Reply
     1. steve says:
        October 26, 2021 at 5:50 pm
        
        Hi
        Tks for pointing it out I have changed it.
        Rgds
        Steve
        
        Reply
        
     
 15. Ikpe says:
     October 11, 2021 at 4:46 am
     
     Tried in the explanation
     Thank you sir
     
     Reply
     
 16. christopher l Tweed Sr says:
     July 19, 2021 at 10:37 pm
     
     i think i need a mathmatical sheet cheat this binary code is giving me
     serious anger lssues
     
     Reply
     
 17. Zabihullah Ibrahimi Afghan says:
     June 8, 2021 at 5:48 am
     
     Thank you sir
     
     Reply
     
 18. Linda says:
     May 17, 2021 at 11:40 pm
     
     This is so amazing
     
     Reply
     


LEAVE A REPLY CANCEL REPLY

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website



Current ye@r *
Leave this field empty


POLLS

Wnat protocol version are you using?

 * MQTTv5
 * MQTTv3.11
 * MQTT-SN



View Results

 Loading ...


EMAIL NEWSLETTER




Please leave this field empty.
Hi - I'm Steve and welcome to my website where you can learn how to build IOT
systems using MQTT.

--------------------------------------------------------------------------------


SEARCH

Search for: Search
 * About Me
 * MQTT Tools
 * Networking


MY YOUTUBE CHANNEL



 * node-red
 * MQTT Brokers
 * mqtt and python
 * Internet







Sitemap |About & Contact | Privacy Policy
Copyright © 2011-2023 Steve's internet Guide
By Steve Cope

We use cookies on our website to give you the most relevant experience by
remembering your preferences and repeat visits. By clicking “Accept All”, you
consent to the use of ALL the cookies. However, you may visit "Cookie Settings"
to provide a controlled consent.
Cookie SettingsAccept All
Manage consent
Close

PRIVACY OVERVIEW

This website uses cookies to improve your experience while you navigate through
the website. Out of these, the cookies that are categorized as necessary are
stored on your browser as they are essential for the working of basic
functionalities of the ...
Necessary
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly.
These cookies ensure basic functionalities and security features of the website,
anonymously.

CookieDurationDescriptioncookielawinfo-checkbox-analytics11 monthsThis cookie is
set by GDPR Cookie Consent plugin. The cookie is used to store the user consent
for the cookies in the category "Analytics".cookielawinfo-checkbox-functional11
monthsThe cookie is set by GDPR cookie consent to record the user consent for
the cookies in the category "Functional".cookielawinfo-checkbox-necessary11
monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to
store the user consent for the cookies in the category
"Necessary".cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR
Cookie Consent plugin. The cookie is used to store the user consent for the
cookies in the category "Other.cookielawinfo-checkbox-performance11 monthsThis
cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the
user consent for the cookies in the category
"Performance".viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie
Consent plugin and is used to store whether or not user has consented to the use
of cookies. It does not store any personal data.

Functional
Functional
Functional cookies help to perform certain functionalities like sharing the
content of the website on social media platforms, collect feedbacks, and other
third-party features.
Performance
Performance
Performance cookies are used to understand and analyze the key performance
indexes of the website which helps in delivering a better user experience for
the visitors.
Analytics
Analytics
Analytical cookies are used to understand how visitors interact with the
website. These cookies help provide information on metrics the number of
visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and
marketing campaigns. These cookies track visitors across websites and collect
information to provide customized ads.
Others
Others
Other uncategorized cookies are those that are being analyzed and have not been
classified into a category as yet.
SAVE & ACCEPT