Chemical Formulas 101

It seems like every other day we hear about some hacker, tinkerer, maker, coder or one of the many other Do-It-Yourself engineer types getting their hands into a complex field once reserved to only a select few. Costs have come down, enabling common everyday folks to equip themselves with 3D printers, laser cutters, CNC mills and a host of other once very expensive pieces of equipment. Getting PCB boards made is literally dirt cheap, and there are more inexpensive Linux single board computers than we can keep track of these days. Combining the lowering hardware costs with the ever increasing wealth of knowledge available on the internet creates a perfect environment for DIYers to push into ever more specific scientific fields.

One of these fields is biomedical research. In labs across the world, you’ll find a host of different machines used to study and create biological and chemical compounds. These machines include DNA and protein synthesizers, mass spectrometers, UV spectrometers, lyophilizers, liquid chromatography machines, fraction collectors… I could go on and on.

These machines are prohibitively expensive to the DIYer. But they don’t have to be. We have the ability to make these machines in our garages if we wanted to. So why aren’t we? One of the reasons we see very few biomedical hacks is because the chemistry knowledge needed to make and operate these machines is generally not in the typical DIYers toolbox. This is something that we believe needs to change, and we start today.

In this article, we’re going to go over how to convert basic chemical formulas, such as C9H804 (aspirin), into its molecular structure, and visa versa. Such knowledge might be elementary, but it is a requirement for anyone who wishes to get started in biomedical hacking, and a great starting point for the curious among us.

Lewis Dots


One of the goals of the chemist is to understand how elements and molecules interact with each other. Atoms will always combine to form a more stable electron structure, and be isoelectronic with the noble gases. It’s the outermost, or valance electrons that interact during bonding, and many chemists find it useful to depict these valence electrons as dots around the atom’s symbol when drawing out chemical formulas. One can look to the periodic table for the atom’s symbol, but can also look at the group number to learn the number of valence electrons in an element. For the main group elements (group A), the group number is the same as the valance electron number. The transition metals (group B) are not usually represented with Lewis dots. Take a look at the image on the upper right to get a clear understanding of how the dots represent the outermost electrons of an element, and how that number corresponds to the group number in the periodic table. Note that the dots are not paired until absolutely necessary.

Covalent Bonding

There are two main ways that atoms can bond with each other — covalent and ionic. Ionic bonding occurs when electrons from an atom that gives them up easily moves to another atom that accepts them easily. This causes an electrostatic charge to exist between them, which makes them stick together. Salt (NaCl) is an example of an ionic bond.

Covalent bonding occurs when atoms share electrons in order to become more stable, like a noble gas. Because noble gases have eight valence electrons, this tendency is referred to as the octet rule. This rule applies to many of the elements involved in biochemistry (such as carbon, nitrogen and oxygen), and allows us to predict how they will bond. Observing the Lewis Dots helps to visualize how covalent bonding occurs between these elements via the octet rule, allowing us to draw them as structures.

Lewis Structures

lewis_03Water (H2O) is probably the best known example of a covalent bond. If we look at the Lewis dot symbol for oxygen, we see that it has 6 valence electrons (or dots). Hydrogen has one. From the oxygen’s viewpoint, it wants to achieve the noble gas structure of the noble gas neon, and it needs two electrons to achieve this. So it bonds with two hydrogen atoms. From the hydrogen’s viewpoint, it wants to achieve the electron state of helium. So it bonds with the oxygen atom. Each atom is in its most stable state — the noble gas configuration. When an electron is shared between the two atoms, the dot is replaced by a single line. See the image on the left.

Source via

The single line that represents the shared electron is known as a single bond. There can be cases of multiple bonds too. Consider ethylene (C2H4). Carbon has 4 valance electrons and hydrogen has one. The two carbon atoms share two electrons each, while each shares another two with two hydrogen atoms. This configuration puts each atom in its neon noble gas electron state. See the image on the right for the Lewis structure of ethylene.

Carbon is a unique element in biochemistry, as it can form nearly endless bonds with itself. In fact, an entire branch called organic chemistry is dedicated to the study of carbon and its derivatives. You will often hear chemists describe themselves as organic or inorganic – each branches into its own unique fields of research.

Benzene – C6H6

benzene-ring-and-shorthandWe all have come in contact with benzene in one way or another. It’s responsible for the odor of gasoline. But more importantly, it’s a key molecule in organic chemistry. It has the shape of a ring, and is known as an aromatic molecule. This means the electrons can move freely around the ring, giving it unique properties, such as enhanced stability. But to stay in line with Lewis structures; I bring up benzene because it is often drawn in a shorthand way that will confuse those who are unaware. To the right is a benzene molecule. But it is often drawn using the short hand shown just below.

[via ChemSpider]
[via ChemSpider]
Note that aspirin (C9H8O4) contains a benzene ring. And now that you know what it is, you will see it in many chemical formulas.

Looking at the non-shorthand Lewis Structure, we see that the six carbons form a bond with each other, with each forming a single bond with a hydrogen atom. Three of the six bonds between the carbon atoms are double bonds. Again, all of this is done so that each atom is in its most stable noble gas state.

Step by Step

Let’s walk through an example of taking a chemical formula to a Lewis Structure. We’ll use H2O for our example

  1. Draw a skeletal structure. Use your new knowledge of the Lewis Dots to arrange the atoms so they’ll bond to satisfy the octet rule. Draw a single line (representing a shared electron) between each of the bonded atoms. With larger molecules, usually the atom with the smallest overall negative charge will be the center atom. lewis_10For water, this would look like: H—O—H
  2. Find the total number of valence electrons. For water, this is 8.
  3. For each bond, represented by the single line, subtract 2. For water, 8 – 4 = 4.
  4. Use the value obtained in step 3 to fill the valence shell of the atoms bonded to the central atom. For water, the hydrogen atoms already have a full valence shell, so we will have leftover electrons.
  5. If any electrons remain, put them on the central atom (as dots). Water would have 4 dots placed on the oxygen atom.
  6. If at the end there are less than 8 electrons on the central atom, remove two of them from one of the outer atoms and make a double bond to the central atom.

I know this has been a review of high school chemistry for some, but it is necessary to understand these basic ideas before we move into things like proteins and carbohydrates. While we didn’t touch on everything, you should now have a basic idea of how to take a simple chemical formula to a Lewis structure, and vice versa. For a more advanced look at the electron structures of the elements and where they come from, see our periodic table post.

33 thoughts on “Chemical Formulas 101

  1. Nice summary & well presented, thanks & takes me back to my early teen chem days when I had my lab inside &
    behind the sliding door of clothes cupboard, those were the days when ammonium dichromate & other pyro-technic
    like chems were combusting without even the idea a fume hood existing as if a 13yr old ever needed one avoiding ‘tactile smells’ !

    I especially like your comment “..involved in biochemistry (such as carbon, nitrogen and oxygen), and allows us to predict how they will bond.” as this also reminds me of one reason I moved into electronics shortly after I realised it was pointless trying to compile a compendium of all carbon based compounds when I found out the permutation space for Carbon is around 10^60 – of which our expression in life molecules is several decades order of magnitudes lower & far less for artificial chemicals – ie We’ve just scratched the surface.

    It gets better as the permutations re further life variants to come takes on the factorial expression re combinations…
    ie Try working out (10^60)! (factorial) on your calculator and don’t be surprised if your ordinary calculator
    can’t do more than 200! – need a few more than 3 significant exponent digits…

    Chemistry sits nicely atop Physics & biochemistry the next & largest arena to wade it, great article, food for thought


  2. A more interesting and relevant write-up than most of what I recall from high school chemistry. I feel this subject is one of the worst offenders of the ‘cram in all these disparate facts and techniques without learning why they’re important or how they relate’ approach to teaching. At least it was in my experience. Organic chemistry seems so useful, but I never took the class due to getting turned off by general chemistry.

  3. I have to quote Serenity here: “It’s worse than you know” – “It usually is”
    Valence gets a lot more complicated as you move down the periodic chart in the middle between the two groups that make up the basic 8 valence types. Elements such as iron (Fe) can have multiple valence levels, usually written using the valence as Fe(II) or Fe(III). Elements such as gold and platinum really don’t like bonding at all, and behave much like the noble gasses (and are thus called noble elements too).
    One edit I would recommend in the excellent lesson above is when describing the 8 electrons in a noble gas: Please mention Helium as the exception, having only two electrons in its outer shell, prior to referencing Helium in describing water’s bonds. For that matter, a more accurate way of describing the situation might be to say that the outermost shell of electrons being ‘full’ is what makes it stable, and the first shell has two, the next eight, the third has 18, and so on using the formula 2(n^2), although most of the chemical reactions happen in the first 8 at each level.
    But if you want to circle back to computing and making, read Wil McCarthy’s articles on programmable matter here: – the idea is that the electrons on the surface of a semiconductor can mimic the valence properties of any atom or molecule, giving the underlying material the physical properties of the mimicked molecule. He took this to its extreme in a series of science fiction books called The Queendom of Sol (start with The Collapsium) – great fun.

    1. Do yourself a favor and get a college level text book. It doesn’t matter which one, or what edition, though something from the last 15 years may be more readable. Keep any eye on local libraries for book sales, especially if you’re in a college town.
      You will almost never see the example the author used written in that manner due to it’s ambiguity. In chemistry, just like language, order matters. -SCN and -NCS are completely different ions. Most chemists would write aspirin or call it by it’s formula names, acetylsalicylic acid or 2-(acetyloxy)benzoic acid. Then there’s the option of including an image. Lastly it could be written as CH3COOC6H4COOH. Writing complex molecules as generic chemical formulae is at best a waste of time for the intended reader. Far better is to include an image if it’s available or a standardized name as both of those give the orientation of the different ion groups.
      As for knowing how things bond just by their formula, except for simple molecules, you probably can’t. Once you get into cyclic molecules you need experiments or instruments to reveal the bond order of molecules. With sufficient time you may be able to figure out the right structure for aspirin using basic rules like the octet, alkane C/N ratios, and charge balancing, but it’s not worth the effort when clear communication keeps people from having the problem in the first place.
      It took August Kekule & others most of their lives to figure out that benzene was a ring with aromatic bonds.

      1. If you study an organic chem book or even a high school AP organic book, you should find the rules for how the naming scheme matches the structure. There must be good Internet sources too. I have not looked.

  4. The thing about chemistry that I’ve never understood is that I always felt like a Cook, rather than a Chef. That is, I was pretty good at balancing equations or following lab directions, and I got conceptually what was going on with bonds, etc. But let’s say I wanted to, I don’t know, make some benzene from scratch. How the heck would I go about figuring out how to reach that desired endpoint given a sufficiently stocked chemistry lab?

    1. Well you introduce Hydrogen and Carbon at a cocktail mixer, and hope they hit it off, failing that, turn up the heat, so they are thrown together in the fires of passion. If that still doesn’t work, try a catalyst to bring them together.

      BTW, screw around with wee sprinkles of everything, last thing you want to find out is how to make nitroglycerine by the 5 gallon pail accidentally.

    2. There is a famous (infamous?) example of what you are describing. The physical chemist who came up with a formula for the first dye LASER shared it with a physics team at another university. The chemist, who painstakingly synthesized the molecule could not get it to lase. The physics team succeeded rather quickly. The chemists kept trying and finally asked the physics group the process they used for synthesizing. Th physics folks said they looked at the molecular weight of each element, weighted out the amounts of each one required, put it all in a shaker with the solvent and stirred it for a while! The chemists had to do the same thing and perform a detailed analysis to find exactly what molecule the physicists had created. I heard the story from the chemist and he thought the whole thing was hilarious :-)

    1. No, benzene has hydrogen bonded on the outside of the carbon ring, whilst graphene only carbon to carbon hexagonal lattices, whilst fullerenes are effectively the same but rolled up into spheres ie Both graphene & fullerene don’t have hydrogen & are no that chemically active – though some oxides show some promise re electrical properties

      1. My mistake … I was referring to carbon rings with alternating single and double covalent bonds between neighbouring vertices, unlike hexagonal structures in graphite, where respective bonds are all single, freeing two valences to connect them to upper and lower layers. I was wondering about any special physical properties of the planar carbon rings (like ones in benzene) and weather are those properties what makes graphene and fullerens so interesting.

    2. It’s traditional when drawing chemical structures to miss out the hydrogens around the edge of a molecule. I dunno the exact rule for when to leave them out, though. Think it mostly applies when it’s carbon that hydrogen is attached to.

      1. Correct.
        Hydrogens are routinely omitted from carbon chains, since they serve only to clutter up the diagram. Unless it serves to clarify the image, hydrogens may be omitted.
        It’s taken as a given that hydrogens are bonded to carbons in order to round out their octets. Imagine trying to draw branch chain or large cyclic hydrocarbons with any clarity if you had to draw hydrogen as well.It’s not such a big problem with 3D render programs since they account for size and use different color, but in line art format it’s nigh impossible.

  5. I am a bit doubtful about DIY biomedical research. Some of this equipment, like DNA and peptide synthesizers, require fume hoods because of the nasty solvents involved. It is difficult to convince a significant other or a landlord to allow the installation of fume hoods. Not to mention, as an individual unaffiliated with university or industrial labs, it is difficult to acquire lab chemicals. Most companies just won’t sell to individuals.

    1. Private labs are everywhere, and many universities also have private labs leased to individuals.

      Chemical supply is a cultural change that has occurred in the past 50 years.
      i.e. you almost always have to sign a purchasers list with your drivers licence even if you buy >100g Sodium Hydroxide.

      Fundamentally, it is the 10 crack heads around the country making elicit drugs to lobotomise their fellow people for fun, and the fear of people victimized by terrorism trying to subjugate other peoples benign interests. Replace the word “terrorism” with “witches”, and the ludicrous illusion of control via proxy becomes self evident.

      All other explanations aside, most manufacturers don’t want to sell $5 worth of solvent to an idiot who never even read the MSDS.

      DNA extraction can be done with vodka and dish soap. ;-)

  6. As an experienced organic chemist and an every once in a while reader of this site (due to the technical nature of a field I’m not familiar with), there are so many times that I think of some DIY device or gizmo that would make my lab life so much easier. But I don’t, because of the time and effort that it’s going to take to learn to do something relatively easy for most of you, when that time is spent eating/sleeping, and learning more organic chemistry.

    I appreciate the effort this article puts out (I do, really!) into getting some basic info out there about my often misunderstood field. This one reminded me how long ago I learned this subject material, and I question how long it’s going to take one person to understand enough to make some headway to make DIY biomedical research into something often seen at maker fairs.

    Perhaps the point of this is for people who understand the tech part well to garner enough interest to reach out to us who hang out in the lab all day and huff solvent for a living?

    1. While most engineers tend to avoid academic paper-mills, there is certainly an open-door faculty policy for repeatable science.

      Seriously make a wish list, explain your general research goals, and use normal language.
      Standard YMMV disclaimer… as you may be asked to cover any significant consumable material costs.
      If you don’t ask you are 100% likely to fail.

    2. As a chem geek who switched to computer programming and hardware because I wanted to make DIY chem experiments: ask away. If you can’t explain it in tech terms, other former lab rats may be able to.

      Who knows, maybe the device you want is the one I dropped out to try making.

  7. It might have been better to mention filling electron shells, rather than the “noble gas” analogy, which seems a bit Victorian. That’s about the limits of my knowledge in chemistry. I realise you don’t want to dump too much information on the reader at once, and sometimes it’s better to teach a wrong approximation, as scaffolding to build the correct knowledge later on. But for this particular point I think it’s better to go with the electron shell theory.

    Interestingly they didn’t teach us that at school, things just had different valencies “because they have”. It meant we had to memorise all of them, rather than being able to calculate them from the atomic number.

    1. Correction:-
      Re wiki link structure on RHS (I had the other window on other screens far left – ugh)

      Grrr Really need comment edit function with timeout here Eg 5mins would be ideal with
      exception if someone quotes the earlier text & its changed before he posts etc… pretty please

      FWIW: Aspirin as synthesized was developed from Salicylic Acid which iirc found in the fresh bark
      of european willow trees & in some species variants leaves to various levels – it has several very
      interesting properties & is added to my looming paper on prehistoric foods which accelerated
      the adaptation of the human; genetically, culturally & especially intellectually as some combinations
      (along with chained moderators) offer nootropic effects, am trialing variants at moment of my own
      formulation – not for sale as public co interest, all fully funded, paper due out end of year I expect)
      Salicylic acid has:
      1. Natural anti-inlfammatory
      2. Blood thinner, not to be used by hemophiliacs !!!
      3. Augments the taste of some food mixes to “Umami” ie that vaguely definable ‘nice taste’
      4. Slight anti-cholesterol action
      5. Interesting reactions with; other food chemicals & unusual mineral mixtures also on trial
      More info here:-

      Warning; Don’t start taking any supplement/formulation or so called “natural compound” with sudden
      step change in diet & especially so if on medication, seek medical advice first – please, your responsibility !

  8. Interesting article, what if… Ancient Egyptians had electric lighting via relatively simple proximity EL from mechanically rotating a fan near crystalline calcium sulphide doped with manganese?
    This could conceivably explain how some of the technology of Ancient Egypt was so advanced yet the knowledge was lost in the fires at the libraries of Alexandria ?
    Intriguingly, some of the earliest references to the mysterious glow in some places in the desert might just have been mechanoluminescence of a naturally occuring variant of this compound just under the sand, similar to how zinc sulphide glows when flexed (seen this here, in EL powder bonded with cyano) pointing to where the compound could be found in nature. The Egyptian alchemists (descended from the noble line of Homo neanderthalensis) of the time were pretty smart and may well have figured this one out along with making fire using manganese dioxide (MnO2) despite having pre-industrial scale knowledge in most areas.
    In fact the Voynich Manuscript refers to similar effects, some of the strange symbolism could have been a lost language linked to the Neanderthals and references to an ancient Atlantean culture lost beneath the waves could also have been a reference to climatic shifts causing massive sandstorms. Sinking beneath the waves of sand no less.. ?!

    1. Possible origin for the burning bush myth re Moses – see comic link below,
      ie luminescence directly behind the bush giving the appearance the bush was on fire etc Of course with a
      sneaky local comic in hiding playing the fool telling someone what to do, which of course they did without
      question, wonderful we moved beyond that re Science & rational appreciation of Evidence re inspiring
      testable hypotheses…

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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