Kilcullen Science and Engineering

Thursday, June 04, 2026

Why Is Most of an Iceberg Under Water? And How Much?

Icebergs floating in the sea
Original uncaptioned image Lurens, public domain image via Pixabay.com

Ninety Percent of an Iceberg Is Below the Waterline

Icebergs can be massive, but did you know that you're only seeing literally the tip of them above the water? Yes, up to 90% of an iceberg's volume can be under water. But why does that amount sink and not just float above sea level like the rest of it? In this article we explore why.

The Archimedean Principle

A body wholly or partially immersed in a fluid experiences an upthrust or buoyant force, equal to the weight of the displaced fluid.

In a previous science tutorial called Archimedes' Principle, Buoyancy Experiments and Flotation Force, we discovered how objects placed in a liquid experience a force called buoyancy.

The Archimedean Principle or Principle of Archimedes simply states that when you put something into a fluid (A fluid can be a liquid like water or gas like air), the force acting upwards on the object equals the weight of fluid that was displaced. Imagine a container full to the brim with water. If something is put into the water in the container, it sinks a bit and floats, totally submerges and floats, or completely sinks to the bottom. The amount of water that flows over the brim is what is displaced. If that water is weighed, it equals the buoyant force pushing up on the object in the water.

Graphic explaining Archimedes' principle
The principle of Archimedes. Buoyant force equals the weight of the displaced liquid. The weight measured by the scales is 6kg less 2 kg = 4 kg. © Eugene Brennan

Working Out the Volume of an Iceberg That's Under the Water

In the image below, we have an iceberg with a lot of its volume under the water. To do the calculations, first let's assign some variables so that we can work out the equations.

V is the total volume of the iceberg

ρi is the density of fresh water ice

ρs is the density of seawater

k is the fraction of the berg that is underwater

g is the acceleration due to gravity

m is the mass of the displaced water

Wd is the weight of displaced water

Wi is the weight of the iceberg

Defining the proportion of an iceberg under the water

Calculations

The total volume of the iceberg is V.

The variable k represents the proportion of the berg that is below the water. k has to be greater than or equal to 0 and less than or equal to 1. In other words, between none and all of the berg lies below the water line. We don't know what k is and it's this variable that we need to work out an equation for.

Calculation of mass of displaced water

The volume of the berg below water = kV
and since the ice displaces its own volume, the volume of displaced water is also kV

The Archimedes Principle tells us that the upthrust or buoyancy force = weight of the displaced water. We need to work out the weight of this water.

We defined a variable ρs as the density of sea water

The volume of the displaced water = the volume of the berg below water = kV

We know that density = mass / volume, so mass = density x volume

So mass of the displaced water m = density of sea water x volume of water displaced.

m = ρskV .......................Eqn (1)

Calculation of weight of displaced water

Now since Archimedes Principle specifies weight, we convert mass to weight by multiplying by the acceleration due to gravity

So weight = mg and substituting for m from Eqn (1), the weight of displaced water

Wd = ρskVg .....................Eqn (2)

Calculation of weight of iceberg

Ice sheets are made from snow that gets packed over long periods of time and converted into ice. Bits of ice eventually break off from the sheets and form floating icebergs. Since icebergs came from snow that originated as water that evaporated off land and sea, they're made of fresh water, not sea water. Pure fresh water has a density of 1 g/cm3. Ice is less dense than water however, because when water freezes, its volume increases. Since density = mass / volume and mass stays the same, but volume increases, density decreases. The density of ice ranges from 0.9167 to 0.9168 g/cm3

Assuming the berg is made of fresh water and its volume is V and the density of fresh water ice is ρi, then the weight Wi of the berg is

Wi = ρiVg .............................Eqn (3)

Forces acting on an iceberg
© Eugene Brennan

Working out k, the proportion of the iceberg under water

Now put Eqn (2) and Eqn (3) together. Since the berg is floating, its weight acting downwards (A in the diagram above) is balanced by the upthrust (force B), equalling the weight of the displaced water)

So upthrust = Wd = weight of iceberg = Wi

Substituting for the values of Wd and Wi from Eqn (2) and Eqn (3) gives:

ρskVg = ρiVg

Simplifying by dividing both sides of the equation by Vg gives us

ρsk = ρi

or k = ρi / ρs

So now two things become apparent:

  • The proportion k of the berg below water is independent of the size of the berg.
  • k doesn't depend on the shape of the iceberg.

The proportion of an iceberg below sea level is simply the ratio of the density of fresh water ice to the density of sea water. If the density of ice is 0.9167 g/cm3 and the density of sea water is on average 1.025 g/cm3 . then

k = 0.9167 / 1.025 = 0.89.

So approximately nine tenths or 90% of an iceberg is under water.

How Much of an Iceberg Is Under Water?

Approximately 90% of an iceberg is under water

Why Is Most of an Iceberg Below Water?

We worked out the numbers mathematically above, but intuitively what is the reason? It's simply because the density of freshwater ice is so close to the density of seawater. So a lot of the iceberg has to sink below the surface to create enough displacement to generate the buoyancy force to balance the weight of the berg to keep it afloat.

If the density of ice equalled that of seawater, the berg would have to submerge completely to generate a buoyancy force to keep itself afloat. If the density was higher again (e.g., if it had lots of rock or gravel embedded inside), the weight of the displaced water would be less than the weight of the berg, even if fully submerged, and it would sink. If an object is made of styrofoam (expanded polystyrene), it only has to displace a little water in proportion to its volume to keep itself afloat and most of its bulk will be above water.

What is a Hydrometer?

A hydrometer is a measuring instrument used to measure the density of a liquid. By measuring density, information can be ascertained about the state of a process. For instance, hydrometers are sometimes used to check the concentration of sulphuric acid in a lead acid battery under charge. If the concentration isn't up to a certain level after several hours, it's an indication that the battery has aged and is no longer performing well. Hydrometers are also used in home brewing and wine making to measure alcohol content of the mix.

How Does a Hydrometer Work?

We established that the proportion of an iceberg under water is simply the ratio of the density of the ice in the iceberg to the density of seawater. The formula for proportion applies to all scenarios when an object is placed in another medium, be it liquid or gas. The formula is for volume, but by making a hydrometer cylindrical, the depth the hydrometer sinks to can be made to represent the density of the liquid. A scale on the side of the hydrometer allows density to be read directly.

Disclaimer 

This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional.

© 2022 Eugene Brennan

What's the Difference Between Analogue and Digital?

Abstract image showing a screen with waveforem and ones and zeroes
© Eugene Brennan

Analogue vs. Digital

We often hear about analogue and digital in the context of communications, sound recording, cameras, TV, radio, and electronic devices. But what exactly is the difference, and is digital better than analogue? Why has digital replaced analogue in audio, digital imaging, and electronic communication?

In this article, I hope to shed light on the mystery.

How Are Analogue and Digital Displays Used?

Although it has nothing to do with the real distinction between analogue and digital, these terms are often used to refer to the type of displays on clocks, measuring devices, and electronic instruments.

An analogue display usually involves some form of pointer which indicates a value depending on its position or angle on a scale. Examples of analogue displays are traditional watches and clocks, weighing scales, speedometers, and old-style moving coil or moving iron voltmeters and ammeters. See the photos below for examples.

A digital display indicates the value of a parameter directly by actually showing a number. This number can be produced on an LED, LCD, fluorescent, or Nixie tube (cold cathode) display. Even the displays on old-fashioned electromechanical cash registers could be thought of as digital, but the term is usually reserved for electronic devices.

Note: the US English spelling of analogue is "analog".

Examples of Analogue Displays

On an analogue display, the value is indicated by a line or pointer. See the examples of analogue displays in the photos below.

An analogue display
Analogue display alarm clock. Mohylek, public domain via Wikimedia Commons
An analogue display
An analogue speedometer Pexels, public domain image via Pixabay.com
An analogue display
Analogue voltmeter. © Eugene Brennan

Example of a Digital Display

On a digital display, a value is displayed as a series of 1 or more numerical or alphanumerical digits. See the examples of digital displays in the photos below.

A digital display
My vintage 1977 calculator. This has a miniature vacuum fluorescent display. © Eugene Brennan

Analogue and Digital Quantities

Another distinction between analogue and digital is in the field of electronics and signals. In the real world, many varying parameters can be considered analogue. So, for instance, the variation of temperature in a room over time is an analogue quantity, as is the voltage of a battery as it discharges.

The characteristic of an analogue parameter or quantity is that its value varies continuously within a range. So the temperature in a room could vary anywhere between 10 and 20 degrees C.

The state of a light switch is either on or off. This is an example of a digital quantity. The switch doesn't exist in an in-between state; it is either on or off. Digital technology is fundamentally based on this idea of on and off states of "switches".

What Is a Signal?

The function of a signal is to convey information about the behavior of some phenomenon. An example is the output of a temperature sensor which provides information about the temperature in a room.

The fluctuations in light level which travel down fiber optic cables are signals (signals don't have to be electrical). The information could be a telephone conversation, internet data, or a TV program. The state of the switch in the example above, measured over time, can be thought of as a digital signal.

Graphs of analogue and digital signals
Analogue and digital signals. The analogue signal varies continuously over time, the digital single is either "high" or "low". © Eugene Brennan

What Is a Sensor?

A sensor converts a real-world parameter such as temperature, pressure, or light level into a signal. This signal may then get amplified and/or processed before being used for some other purpose. Some examples:

  • In instrumentation, the signal from a sensor could drive a display indicating the value being measured, e.g., speedometer in a vehicle, temperature gauge, or voltmeter
  • In communications, sound or pictures from microphones or cameras are converted to an electrical signal which eventually gets transmitted as radio waves.

How Do Digital Signals Work?

A digital signal has two states or levels, high and low. The signals in a digital computer or instrumentation such as a digital voltmeter are two-state. A computer doesn't understand analogue signal levels and just works on high and low states, effectively ones and zeros.

For a more thorough explanation of this and an explanation of the binary number system, see my article "Why is Binary Used in Computers?"

What Does Sampling Mean?

Sampling is a process that converts a real-world signal to a digital format which can then be processed by a computer, instrumentation, or other digital electronics technology.

Some examples:

  • A digital multimeter (DMM) samples a voltage, converts it to digital, and the digital signals are used to drive a display.
  • An image projected by the lens of a digital camera falls on the CCD (Charged Coupled Device) at the back of the camera. The image is converted to numbers and stored in the camera's flash memory.
  • A scanner scans a document. The resultant image is stored in memory.
  • A sound recording is made. The audio signal is converted to digital and saved on a hard disk or printed onto a CD.

Analogue to Digital Conversion

As digital electronics and computers were developed, applications arose for reading signals from the real world. The process to do this is called sampling, whereby an analogue signal is converted to a binary number understandable by a computer.

A device that does this is called an analogue-to-digital converter (ADC). An ADC measures the level of the analogue signal at regular intervals, known as the sampling frequency. The voltage range over which the ADC works (e.g., 0 to 5V or 0 to 10V) is broken up into equally spaced ranges and a binary number is assigned to each of these ranges.

Each time the ADC samples the signal, it outputs a binary number, representative of the level at the instant of sampling. These numbers can then be stored, used to drive a display, transmitted along a communication line, etc.

For a 3 bit converter (see diagram below), there are 23 = 8 possible binary numbers. In reality, ADC converters have 6, 12, 16, or even 24-bit resolution (16 bit at 44kHz sampling rate is used for CD recordings). Obviously, this means that there are lots more levels, and the converter can resolve more detail in the signal.

A graphic showing the concept of sampling
Sampling an analogue signal. There are 8 possible levels; the converter outputs a 3 bit number depending on the level of the analogue signal. © Eugene Brennan

A to D Converter Resolution

As I mentioned before, A to D converters typically have resolutions of 6 to 16 bits, although 24-bit converters are available.

The number of levels which a converter can resolve is equal to 2n , where n is the number of bits of the converter. So for a 6-bit converter, there are 64 levels and for a 16-bit converter, there are 216 = 65,536 levels.

A converter has an input range over which it works, e.g., 0 to 5 volts, and it is this range that is split up into equal ranges. So to get the most amount of "detail" out of a signal, the signal should span as much of this range as possible.

What analog to digital converter chips look like
An ADC is often an IC (chip) like the ones above. Left image Jon Sullivan, right image Kimmo Palosaari - Images public domain via Wikimedia Commons
Schematic of an ADC integrated circuit
Block diagram of a typical ADC. A start conversion signal initiates a conversion. The ADC generates an end of conversion signal on completion. An 8 bit converter can resolve 2 to the power of 8 = 256 different levels. © Eugene Brennan

Minimum Sampling Frequency of a Waveform: The Nyquist–Shannon Sampling Theorem

The maths behind this theorem is a bit complicated, but basically, it says that the sampling rate of a signal must be at least twice the highest frequency content of the signal.

This is intuitively correct, so, for instance, the slowly changing signal from a temperature sensor in a room would need to be sampled much less frequently than an audio signal from a microphone or video signal from a camera in order to preserve the rapid changes in the signal.

Reproducing a Signal: Digital to Analogue Converter (DAC)

Once a signal has been sampled, several things can be done with it. In the case of instrumentation, e.g., a digital multimeter, data may not need to be stored. Instead, the digital output signal of the ADC drives the display on the instrument (through intermediate driver electronics).

Alternatively, data can be stored in a computer as a set of numbers: in random access memory (RAM ), on a hard drive, or on a CD or DVD. Sometimes a signal which has been sampled and stored must be reproduced. An example of this is an audio recording on a CD. A device called a digital-to-analogue converter (DAC) is used to reproduce the original signal.

The DAC does the same job as the ADC in reverse. Each binary number that was stored during the original recording is input to the DAC at a playback rate equal to the original sampling frequency. The output of the DAC is an analogue voltage level. The signal is then filtered to remove the "staircase" effect due to sampling.

Graphic showing the limitation of low-res sampling
Sampled signal is stored as a set of numbers. When this signal is reconverted back to analogue, filtering must be used to remove the "staircase" effect. © Eugene Brennan

Digital Electronics

Some electronic devices are almost purely digital and don't need to sample analogue signals. An example is a digital watch or clock which makes use of a quartz oscillator. An oscillator is a system that does something at regular intervals, e.g., a swinging pendulum or a flashing light.

The frequency of a quartz oscillator is very stable and has a relatively low sensitivity to temperature, unlike the components of a mechanical clock. The output of the oscillator is a square wave voltage, usually at 32,768 Hz, i.e., a digital signal.

This frequency is a power of 2 and is chosen so that it can be successively divided by 2 by a digital counter to produce a 1-second pulse. Other counters then generate minute and hour outputs every 60 and 3600 seconds for driving the digital display. (Digital quartz watches can also have analogue displays)

Increasing the Signal to Noise Ratio

The process of storing and transmitting data in digital format is, in effect, increasing the signal-to-noise ratio (SNR or S/N). There are no low-level signals, just highs and lows. Digital electronics "decide" whether a bit is high or low depending on whether it is within a high or low band of voltages.

What Are the Advantages of Digital Data?

Once a signal is sampled and the data is converted to a series of numbers in memory, lots of things can be done with it.

  • Data can be stored and copied indefinitely without degradation. This is because numbers in memory or on digital media are stored in binary format as ones and zeros. In memory, electronic switches are either on or off, representing the storage of 1 or 0. This single piece of information is known as a bit.

    On a CD, either a 1 or 0 can be represented by a pit on the surface of the disk. Contrast this with an analogue recording on tape (which could be audio or video). Low-level signals get swamped by noise over time, and noise also gets introduced during the copying process. This also applies to image recording on photographic media, such as a traditional negative.

  • Clearer audio communication. Because digital increases the SNR, radio and telephone communication and radio broadcasts are clearer without the introduction of noise. Increasing the SNR is somewhat similar to the idea of how the phonetic alphabet can be used during radio communication or a telephone call to improve intelligibility. Each letter of a message is represented by a word - (e.g., "Car" as "Charlie - Alpha - Romeo") so that a transmission can be understood.
  • Data can be compressed Since data is stored as numbers, fancy algorithms can be used to compress the data. This is advantageous because data files can be made smaller and require less storage space (think JPEG and MP3 which are formats for storing and compressing images and sound). Digital TV and digital radio also make use of these compression techniques (MPEG 4 compression for TV).

    The radio frequency spectrum is limited, and only so many channels can be squeezed onto the spectrum. Compressing TV signals narrows the required bandwidth for a channel so more channels can be squeezed into a frequency band ( which may be a good or bad idea! It reminds me of Bruce Springsteen's song, "57 Channels and Nothin' On).

What Are the Disadvantages of Digital Data?

  • A decoding device is required. Data that is stored on media is usually compressed, encoded, and formatted in some way. Equipment to read and decode the archived data may not be available in the future. For instance, if you have any 5 1/4 inch floppy disks with data on them, do you still have a computer that can read these disks?

    Yet it is even possible to read the information from books written hundreds of years ago and view the illustrations or view photographs from the mid-nineteenth century. It would also be relatively easy to build a machine that could play early wax cylinder phonographic recordings. This is obviously an issue for archivists of important information.

  • Digital data is not necessarily durable. While digital data on media is theoretically rugged and less likely to be degraded than an analogue recording, in practice, if the media is damaged, it may not be possible to read data (e.g., a seriously scratched CD). However, an analogue tape recording could probably be pieced together and played.

    Similarly, a photograph (a traditional non-digital type, which is, in effect, a two-dimensional, analogue, optical recording) can still be viewed if stained or damaged in some other way. The moral of the story is to always back up your digital data (and back up the backup!)

What Are TTL and CMOS?

TTL (Transistor-Transistor Logic) and CMOS (Complementary Metal Oxide Silicon) are two technologies used to implement switches in the integrated circuits of digital electronic devices. CMOS has the advantage that it is low power which, of course, is important for battery-powered devices.

Digital ICs have input and output pins, and the voltages on these pins are within designed tolerance bands. For instance, if a high output of a TTL chip is connected to the input of another TTL chip, the output voltage must be between 2.7 and 5 volts. Inputs between 2 and 5 volts are interpreted as high.

Similarly, a low output must be between 0 and 0.5 volts, even though anything between 0 and 0.8 is interpreted as low. This means that up to 0.3 volts of noise can be added to a signal without it being misinterpreted.

TTL threshold levels
TTL(Transistor Transistor Logic) is a type of technology used in digital electronics. Output signal levels of TTL ICs must be within the acceptable range of voltages shown above. © Eugene Brennan
High-magnification image of the bumps on a CD
Electron microscope image of a CD. Data is stored as "pits" on the CD. Pits are approximately 100nm deep, 500 nm wide and 850nm to 3.5 microns long. Freiermensch, Creative Commons Attribution 3.0 Unported via Wikimedia Commons

Disclaimer 

This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.

© 2014 Eugene Brennan

Comments From Readers 

Tutu on October 03, 2017:

Wow

Beautiful article

It is so helpful

Ronald E Franklin from Mechanicsburg, PA on August 26, 2015:

As a former electrical engineer, the info you cover in this hub was once my everyday bread and butter. Congrats on a good overview.

Eugene Brennan (author) from Ireland on August 27, 2015:

Thanks Ron! Hopefully it should shed some light on the mystery. Often words like "analog", "digital", "RAM", "JPEG" etc are used as buzz words but without any understanding of what they mean.

Writer Fox from the wadi near the little river on February 02, 2014:

Very comprehensive explanation! You are a real expert in this topic and you have explained the differences so well. I think many people will find this article useful, especially students. Enjoyed and voted up!

Eugene Brennan (author) from Ireland on February 02, 2014:

Thanks, glad you liked it and it made sense! As with any of these types of topics, in reality, things can get quite complex because of all the communication protocols, storage formats etc which are involved. The basic concept of analogue and digital however is quite simple.

Tim Anthony on January 30, 2014:

A very nice and informative hub. Consider detailing the digital data transmission over wireless networks like wi-fi and bluetooth. The emerging trends, versions and technologies too.

John MacNab from the banks of the St. Lawrence on January 30, 2014:

Brilliant eugbug. I had just finished asking my electronically knowledgeable wife what the difference was and I didn't understand her answer. Your hub explains it perfectly. Voted up+

Eugene Brennan (author) from Ireland on January 30, 2014:

Thanks John and Tim!

I'll add more info to this hub later, but probably deal with bluetooth, comms and wi-fi in a separate article.

Vodafone Internet Service Down After Thunderstorm

 

Screenshot of an Internet speed test
The Internet was dropping intermittently since the thunderstorm the other night. A Vodafone technician replaced the modem yesterday afternoon, but still no go. Then the service disappeared completely when the technician was still working on it. The issue was raised to a higher level and I spotted an Eir van this morning in Conroy Park, but couldn't see the technician, so I could have a chat and discover what the problem was. I suspect water in junction boxes or electronics fried by a surge due to a lightning strike. Unfortunately Eir won't give any information and Vodafone know nothing. Anyway service is back, but I would have liked to know the cause of the fault. Maybe everyone's on fibre now (which is insensitive to lightning spikes), so I was the only one affected, still using copper to the cabinet. The Vodafone Gigabit Broadband speed of 1,000 Mbps or 1Gbps is unnecessary for most people, despite their hype and marketing, and sales agents trying to push it. A 100 Mbps is service is perfectly adequate unless there are lots of people in a house doing loads of high-throughput, Internet activity. The other issue is when a premises is distant from a cabinet, which reduces the max bitrate sustainable.
I'm getting 96 Mbps now and sometimes the full 100 Mbps service.
You can check whether your ISP is giving you what you pay for using the website Fast.com or other similar sites.

Tuesday, June 02, 2026

Why Is Binary Used in Electronics and Computers?

Abstract image with magnifying glass and series of ones and zeroes, representing binary

Why is binary used in electronics? Geralt via Pixabay.com

Why Do Computers Use Binary?

The binary numbering system is the basis for the storage, transfer and manipulation of data in computer systems and digital electronic devices. This system uses base 2 rather than base 10, which is what we are familiar with for counting in everyday life. By the end of this easy-to-understand article, you'll have a grasp of why binary is used in computers and electronics.

What Is Decimal and Why Do We Use It?

Before we learn about binary, let's start with decimal.

The decimal, base 10 or denary numbering system is what we are familiar with in everyday life. It uses 10 symbols or numerals. To count, we go:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ...

... But there's no numeral for the next number, the integer value we interpret as "ten". Ten is therefore represented by two digits: the numeral 1 followed by 0, so ten is represented as "10", which really means "one ten and no units". Similarly, one hundred is represented by three digits: 1, 0 and 0; i.e., one hundred, no tens and no units".

Basically, numbers are represented by a series of numerals in the units, tens, hundreds, thousands place etc. For instance, 134 means one hundred, three tens and four units. The decimal system probably arose because we have 10 fingers on our hands, which could be used for counting.

Abstract image with a series of ones and zeroes, representing binary
Public domain image via Pixabay

What Is Binary and How Does It Work?

The binary system used by computers is based on two numerals: 0 and 1. So you count:

0, 1

... But there's no numeral for 2. So 2 is represented by 10 or "one 2 and no units". In the same way that there is a units, tens, hundreds, and thousands place in the decimal system, in the binary system, there is a units, twos, fours, eights, sixteens place etc. in the binary system. So the binary and decimal equivalents are as below:

  • 00000000 = 0
  • 00000001 = 1
  • 00000010 = 2
  • 00000011 = 3
  • 00000100 = 4
  • 00000101 = 5
  • 00000110 = 6
  • 00000111 = 7 (and so on)
Animated image showing a counter counting in binary

Counting in binary from 0 to 11111 = 31 decimal. Ephert, CC by SA 4.0 via Wikimedia Commons

Digital chips on a printed circuit board

A printed circuit board (PCB) with digital integrated circuits (ICs or "chips"). Olafpictures, public domain image via Pixabay.com

Why Do Computers Use Binary?

"A single switch can be on or off, enabling the storage of 1 bit of information. Switches can be grouped together to store larger numbers. This is the key reason why binary is used in digital systems."

How Is Binary Used in Digital Computers and Electronic Devices?

Numbers can be encoded in binary format and stored using switches. The digital technology which uses this system could be a computer, calculator, digital TV decoder box, cell phone, burglar alarm, watch etc. Values are stored in binary format in memory, which is basically a bunch of electronic on/off switches.

Imagine if you had a bank of 8 rocker switches, just like in the image below. Each switch could represent 1 or 0, depending on whether it is turned on or off. So you think of a number and set the switches on or off to "store" the binary value of this number. If someone else then looked at the switches, they could "read" the number.

A bank of eight rocker switches illustrating concept of binary
8 bit “memory” made from a gang of rocker switches. Conceptual idea of how the state of a bank of eight switches allows the "storage" of 2 to the power of 8 = 256 possible numbers. © Eugene Brennan

How Does a Computer Implement Switches

So how does a computer store binary numbers? Obviously, banks of rocker switches would be ridiculously impractical (although a similar technique was used in early computers when programming) In a computer, switches are implemented using microminiature transistors.

The smallest memory configuration is the bit, which can be implemented with one switch. If 8 switches are added together, you get a byte. The digital hardware is able to set the switches on and off (i.e. write data to a byte) and also read the state of the switches. In the conceptual image of rocker switches we saw above, there are 8 switches and 28 = 256 permutations or arrangements depending on whether a switch is on or off. If on represents 1 and off represents 0 for each switch, the group of switches can represent any of the following values.

  • 00000000 0 decimal
  • 00000001 1 decimal
  • 00000010 2 decimal
  • 00000011 3 decimal
  • 00000100 4 decimal
  • ...
  • 11111110 254 decimal
  • 11111111 255 decimal

In an electronic device or computer, because of micro-miniaturisation, billions of switches can be incorporated into integrated circuits (IC), potentially allowing the storage and manipulation of huge amounts of information.

Binary and Decimal Equivalents

Binary and Decimal Equivalents
BinaryDecimal
00
11
102
113
1004
1015
1106
1117
10008
10019
101010
101111
110012
110113
111014
111115
1000016

Representing Non-Integer Values in Computer Systems

Integers can be stored and processed directly as their binary equivalents in computer systems; however, this isn't the case with other data. A machine such as a computer, digital camera, scanner etc., cannot directly store decimals, non-numerical (text, image, video) or analogue measurement data from the real world directly. This type of data could be:

  • Person's name or address
  • Temperature measured in a room
  • Image from a digital camera or scanner.
  • Audio
  • Video
  • Decimal number

Representing Data in Floating Point Format

Decimal numbers are represented in computer systems using a system known as floating point. A decimal number can be represented approximately, to a certain level of accuracy by an integer significand multiplied by a base, raised to the power of an integer exponent.

Processing and Storage of Analogue Data

A voltage level from a temperature sensor is an analogue signal and has to be converted to a binary number by a device called an analogue-to-digital converter (ADC). These devices can have various resolutions, and for a 16 bit converter, the signal level is represented by a number from 0 to 216 = 65535. ADCs are also used in image scanners and digital cameras—electronic equipment used to record sound and video and basically any digital device that takes input from a sensor. An ADC converts a real-world analogue signal into data that can be stored in memory. Images created in a CAD drawing package are also broken down into individual pixels, and a byte of data is used for the red, green and blue intensity levels of each pixel.

Graphs showing analog and digital signals
Digital signals in electronic circuitry are either high or low, representing a "1" or "0". © Eugene Brennan

Encoding Text Data as ASCII

Names, addresses or other text entered into a computer can't be stored directly in computer memory. Instead the text is broken down into individual letters, numerals and other non alphanumeric characters (e.g., &*£$# etc) and a coding system called ASCII represents each character by a number from 0 to 127. This data is then stored in binary format as one or more bytes in memory, each byte being made up of individual bits, and each bit implemented using transistors.

ASCII Table Hex, Binary and Decimal Values

Table showing ASCII characters with their hexadecimal, binary and decimal values. Hexadecimal or "hex" is a convenient way of representing a byte or word of data. Two characters can represent 1 byte of data.

A table showing ASCII characters and their values in decimal, binary and hexadecimal
ASCII code table. ASCII assigns a number from 0 to 127 to letters, numbers, non alphanumeric characters and control codes. Public domain image via Wikimedia Commons

What Is Machine Code and Assembly Language?

Not only are values or data stored in memory, but also the instructions which tell the microprocessor what to do. These instructions are called machine code. When a software program is written in a high level language such as BASIC, Java or "C", another program called a compiler breaks the program down into a set of basic instructions called machine code. Each machine code number has a unique function which is understood by the microprocessor. At this low level, instructions are basic arithmetic functions such as add, subtract and multiply involving the contents of memory locations and registers (a cell which can have arithmetic operations carried out on it). A programmer can also write code in assembly language. This is a low level language comprising instructions known as mnemonics which are used to move data between registers and memory and perform arithmetic operations.

How to Convert Decimal to Binary and Binary to Decimal

This tutorial explains how to convert decimal to binary and binary to decimal.

George Boole and Boolean Algebra

Boolean algebra, developed by the British mathematician George Boole in the 19th century, is a branch of mathematics which deals with variables which can only have one of two states, true or false. In the 1930s, Boole's work was discovered by the mathematician and engineer Claude Shannon, who realised it could be used to simplify the design of telephone switching circuits. These circuits originally used relays which could be either on or off, and the desired output state of the system, depending on the combination of states of the inputs, could be described by a Boolean algebraic expression. Boolean algebra rules could then be used to simplify the expression, resulting in a reduction of the number of relays required to implement a switching circuit. Eventually Boolean algebra was applied to the design of digital electronic circuitry as we will see below.

Digital Logic Gates: AND, OR and NOT

A digital state, ie high/low or 1/0 can be stored in a one-bit cell in memory, but what if that data has to be processed? The most basic processing element in a digital electronic circuit or computer is a gate. A gate takes one or more digital signals and generates an output. There are three types of gates: AND, OR and NOT (INVERT). In their simplest form, small groups of gates are available on a single IC. However, a complex combinational logical function can be implemented using a Programmable Logic Array (PLA) and more sophisticated devices such as microprocessors are composed of millions of gates and memory storage cells.

  • For an AND gate, the output is true or high only when both inputs are true.
  • For an OR gate, the output is high if either or both inputs are true.
  • For a NOT gate or inverter, the output is the opposite state to the input.

Boolean algebraic expressions can be used to express what the output signal of a circuit should be, depending on the combination of inputs. The main operations in Boolean algebra are and, or and not. During a design process, the required value of an output for all the various permutations of input states can be tabulated in a truth table. The value '1' in the truth table means an input/output is true or high. The value '0' means the input/output is false or low. Once a truth table is created, a Boolean expression can be written for the output, simplified and implemented using a collection of logic gates.

So a typical Boolean expression with three independent variables A, B and C and one dependent variable D would be:

Y = A.B + C

This is read as "Y = (A and B) or C"

Diagram showing Digital AND, OR and NOT gates and a truth table
Logic gates, AND, OR and NOT and their truth tables. © Eugene Brennan
A simple digital schematic, with its truth table
Truth table for a simple digital circuit. Y = A.B + C © Eugene Brennan

Disclaimer

This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualised advice from a qualified professional.

© 2012 Eugene Brennan

How to Convert Decimal to Binary and Binary to Decimal

Base 2, the Basis for Binary Code

The base 2, or binary numbering system is the basis for all binary code and data storage in computing systems and electronic devices. This guide shows you how to convert from binary to decimal and decimal to binary.

Diagram showing equivalent decimal and binary numbers
Binary number and its decimal equivalent. © Eugene Brennan

Decimal, the Base 10 Numbering System

First let's start with decimal.

The decimal, also known as the denary or base 10 numbering system is what we use in everyday life for counting. The fact that there are ten symbols is more than likely because we have 10 fingers.

We use ten different symbols or numerals to represent the numbers from zero to nine.

Those numerals are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9

When we get to the number ten, we have no numeral to represent this value, so it is written as:

10

The idea is to use a new place holder for each power of 10 to make up any number we want.

So 134 really means one hundred, 3 tens and 4 units, although we just interpret and read it as the number one hundred and thirty four.

Placeholder Value in the Decimal Numbering System

Infographic showing placeholder in decimal system
Placeholder value in the base 10 number system. © Eugene Brennan

Binary, the Base 2 Numbering System

In the decimal number system, we saw that ten numerals were used to represent numbers from zero to nine.

Binary only uses two numerals 0 and 1. Place holders in binary each have a value of powers of 2. So the first place has a value 20 = 1, the second place 21 = 2, the third place 22 = 4, the fourth place 23 = 8 and so on.

In binary we count 0, 1 and then since there's no numeral for two we move onto the next place holder so two is written as 10 binary. This is exactly the same as when we get to ten decimal and have to write it as 10 because there's no numeral for ten.

Placeholder Value in the Binary Numbering System

Infographic showing placeholder value in binary system
Placeholder value in the binary number system. © Eugene Brennan

Most Significant Bit (MSB) and Least Significant Bit (LSB)

Infographic explaining least significant bit and most significant bit
Most significant bit (MSB) and least significant bit (LSB). © Eugene Brennan

For a binary number, the most significant bit (MSB) is the digit furthermost to the left of the number and the least significant bit (LSB) is the rightmost digit.

Decimal and Binary Equivalents


Decimal Binary

0

0

1

1

2

10

3

11

4

100

5

101

6

110

7

111

8

1000

Steps to Convert from Decimal to Binary

If you don't have a calculator to hand, you can easily convert a decimal number to binary using the remainder method. This involves dividing the number by 2 recursively until you're left with 0, while taking note of each remainder.

  1. Write down the decimal number.
  2. Divide the number by 2.
  3. Write the result underneath.
  4. Write the remainder on the right hand side. This will be 0 or 1.
  5. Divide the result of the division by 2 and again write down the remainder.
  6. Continue dividing and writing down remainders until the result of the division is 0.
  7. The most significant bit (MSB) is at the bottom of the column of remainders and the least significant bit (LSB) is at the top.
  8. Read the series of 1s and 0s on the right from the bottom up. This is the binary equivalent of the decimal number.
Steps fror converting from decimal to binary
Converting decimal to binary. © Eugene Brennan

Steps to Convert Binary to Decimal

Converting from binary to decimal involves multiplying the value of each digit (i.e. 1 or 0) by the value of the placeholder in the number

  1. Write down the number.
  2. Starting with the LSB, multiply the digit by the value of the place holder.
  3. Continue doing this until you reach the MSB.
  4. Add the results together.
Steps for converting from decimal to binary
Converting binary to decimal. © Eugene Brennan

Test Yourself!

  1. What is 548 in binary?
  2. What is 101011001 in decimal?
  3. What is 01010101 in decimal?

Answers at bottom of page

Indicating the Base of a Number

The binary number 1011011 can be written as 10110112 to explicitly indicate the base. Similarly 54 base 10 can be written 5410 Often however, the subscript is omitted to avoid excessive detail when the context is known. Usually subscripts are only included in explanatory text or notes in code to avoid confusion if several numbers with different bases are used together.

What is Binary Used For?

For more details on how binary is used in computer systems and digital electronics, see my other article:

Why is Binary Used In Computers and Electronics?

What Other Bases Are There Apart From 2 and 10?

Base 16 or hexadecimal (hex for short) is a shorthand used when programming computer systems. It uses sixteen symbols, representing 10, 11, 12, 13, 14 and 15 decimal with the letters A, B, C, D, E, and F respectively. You can read more about converting hex to binary and binary to hex here:

How to Convert Hex to Binary and Binary to Hexadecimal

Answers to Problems

  1. 548 decimal is 1000100100 binary
  2. 101011001 is 345 decimal
  3. 01010101 is 85 decimal

© 2018 Eugene Brennan

Sunday, May 31, 2026

How to Convert Hex to Binary and Binary to Hexadecimal

The Hexadecimal Numbering System

The base 16, also known as hexadecimal (abbreviated to hex) numbering system is regularly used in computer coding for conveniently representing a byte or word of data. This guide shows you how to convert from hex to binary and binary to hexadecimal.

Graphic showing hex and binary versions of a number
© Eugene Brennan

Decimal, the Base 10 Numbering System

Before we learn how to convert hex to binary, let's try and understand how the base 10 system works.

The decimal, also known as the denary or base 10 numbering system that we use in everyday life makes use of ten symbols or numerals: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.

So to count you start with 0, then continue 1...2...3...4...5...6...7...8...9

What happens when you get to ten? There's no numeral for ten, so it's represented as

10

Which means 1 ten and no units

Similarly when you get to 99, there's no numeral for one hundred, so you write one hundred as 100.

So writing a number in the base 10 system involves using numerals in a "units", "tens", "hundreds", "thousands" place and so on

So 145 really means "one hundred, 4 tens and 5 units" although we just think of it as the number one hundred and forty five.

Hexadecimal, the Base 16 Numbering System

Hexadecimal or "hex" is a numbering system which uses 16 different numerals. We saw that decimal used ten numerals from 0 to 9. Hex expands on this by adding six more—the capital letters A, B, C, D, E and F.

So to count from 0 to 9 you go 0...1...2...3...4...5...6...7...8...9

But what happens next?

Simply continue with A...B...C...D...E...F which represents 10, 11, 12, 13, 14 and 15 decimal.

So now to count to 15 we go 0...1...2...3...4...5...6...7...8...9...A...B...C...D...E...F

In the decimal system, we saw that when we got to nine, there was no numeral for ten so it was represented as 10 or "one ten and no units".

In the hex system when we get to F which is 15 decimal, we have to represent the next number sixteen as 10 or "one 16 and no units".

Binary, the Base 2 Numbering System

The binary system used by computers is based on 2 numerals; 0 and 1. So you count 0, 1, there is no numeral for 2, so 2 is represented by 10 or "one 2 and no units". In the same way that there is a units, tens, hundreds, thousands place in the decimal system, in the binary system there is a units, twos, fours, eights, sixteens place etc. in the binary system.

Decimal to Hex and Binary Table

Binary, decimal and hex equivalents.

DecimalHexBinary

0

0

0

1

1

1

2

2

10

3

3

11

4

4

100

5

5

101

6

6

110

7

7

111

8

8

1000

9

9

1001

10

A

1010

11

B

1011

12

C

1100

13

D

1101

14

E

1110

15

F

1111

16

10

10000

17

11

10001

18

12

10010

19

13

10011

20

14

10100

...

...

...

25

19

11001

26

1A

11010

27

1B

11011

28

1C

11100

29

1D

11101

30

1E

11110

31

1F

11111

32

20

100000

33

21

100001

34

22

100010

Indicating the Base of a Number

If a number isn't decimal (base 10), the base can be explicitly indicated by a subscript to avoid confusion. Sometimes the subscript is omitted to avoid excessive detail if the base has been specified earlier in a discussion or if numbers are listed in a table (e.g. numbers may be indicated as hex in the title of the table).

So for instance 1F hex (31 decimal) can be written 1F16

Steps to Convert Hex to Binary

Hex is very easy to convert to binary.

  1. Write down the hex number and represent each hex digit by its binary equivalent number from the table above.
  2. Use 4 digits and add insignificant leading zeros if the binary number has less than 4 digits. E.g. Write 102 (2 decimal) as 00102.
  3. Then concatenate or string all the digits together.
  4. Discard any leading zeros at the left of the binary number.
Graphic showing how to convert hex t obinary
© Eugene Brennan

Most Significant Bit (MSB) and Least Significant Bit (LSB)

For a binary number, the most significant bit (MSB) is the digit furthermost to the left of the number and the least significant bit (LSB) is the rightmost digit.

Graphic explaining MSB and LSB of a binary number
© Eugene Brennan

Steps to Convert Binary to Hex

Binary is also easy to convert to hex.

  1. Start from the least significant bit (LSB) at the right of the binary number and divide it up into groups of 4 digits. (4 digital bits is called a "nibble").
  2. Convert each group of 4 binary digits to its equivalent hex value (see table above).
  3. Concatenate the results together, giving the total hex number.
Grpahic explaining how to convert a binary number to hex
© Eugene Brennan

Test Yourself!

For each question, choose the best answer. The answer key is below.

  1. Convert ABCD hex to binary
    • 10101010
    • 1010101111001101
    • 1111111011001101
    • 1111000011101010
  2. What is 10101010 in hex?
    • AA
    • FF
    • FD
    • 1010
  3. Convert FFFF to decimal
    • 15151515
    • 255255
    • 65,535
    • 3125

Answer Key

  1. 1010101111001101
  2. AA
  3. 65,535

What is Hex Used For?

Because of the ease of converting from hex to binary and vice versa, it's a convenient shorthand for representing byte values i.e. numbers from 0 to 255. Also it is compact, requiring only 2 digits for a byte and 4 digits for a word.

Typical uses of hex:

  • Hex dumps are listings of the bytes in a file in hex format. Because decimal or binary numbers can be displayed compactly as pairs or multiple pairs of digits or characters from A to F, values line up in columns and are easy to trace through.
  • Assembly language is written as a series of mnemonic (short, easy to remember word) instructions for a microprocessor. The operand (the data operated on by an opcode) is commonly specified as a hex value. It's also used to indicate the storage location of data

Example of assembly language instruction

In the short code segment below, MOV is the opcode (instruction) and 61 hex is the operand that the opcode acts on. AL is a register that stores a value temporarily so that arithmetic can be done on it before it's moved to memory. A program called an assembler converts the human understandable assembly language to machine code.

MOV AL, 61H ; Load AL register with 61 hex (97 decimal )

Assembly Language Program for an 8 Bit Microprocessor

An assembly language program
Original image public domain via Wikimedia Commons

Hex Dump of a File

A hex dump of machine code for a microprocessor
A "hex dump" or byte value listing of a JPG file as viewed in a file editor. On the left, each byte is displayed as a hex value. On the right, alphanumeric characters corresponding to ASCII values of the bytes are shown. © Eugene Brennan

ASCII Code Table

A table explaining ASCII
Two hex numerals also conveniently represent the 255 codes of the extended ASCII character set, used in computing for communication and text storage and display. Yuriy Arabskyy, CC-SA-3.0 via Wikimedia Commons

How to Convert Decimal to Binary

To convert decimal to binary and binary to decimal, see my other guide:
How to Convert Decimal to Binary and Binary to Decimal

What is Binary Used For?

For more details on how binary is used in computer systems and digital electronics, see my other article:

Why is Binary Used In Computers and Electronics?

How to Convert Hex to Decimal

You can convert hex to decimal by simply multiplying each hex numeral by the placeholder's value as a power of 16 and adding the result. (F16 = 15 decimal and A16 = 10 decimal)

Example: What is the decimal equivalent of 52FA16 ?

52FA16 = 5 x 163 + 2 x 162 + 15 x 161 + 10 x 160

= 5 x 4096 + 2 x 256 + 15 x 16 + 10 x 1

= 21,242

This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.

© 2018 Eugene Brennan

×

Posts by Category