If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Molecules and compounds

Compounds can be classified as ionic or covalent. Molecules are the simplest unit of a covalent compound, and molecules can be represented in many different ways. 
Atoms are the smallest units of matter that still retain the fundamental chemical properties of an element. Much of the study of chemistry, however, involves looking at what happens when atoms combine with other atoms to form compounds. A compound is a distinct group of atoms held together by chemical bonds. Just as the structure of the atom is held together by the electrostatic attraction between the positively charged nucleus and the negatively charged electrons surrounding it, the stability within chemical bonds is also due to electrostatic attractions. To illustrate further, consider the two major types of chemical bonds: covalent bonds and ionic bonds. In covalent bonds, two atoms share pairs of electrons, while in ionic bonds, electrons are fully transferred between two atoms so that ions are formed. Let’s consider both types of bonds in detail.

Covalent bonds and molecules

A covalent bond is formed when two atoms share electron pairs. In a covalent bond, the stability of the bond comes from the shared electrostatic attraction between the two positively charged atomic nuclei and the shared, negatively charged electrons between them.
A neutral hydrogen atom, shown left, contains one electron. Two hydrogen atoms can combine by donating each of their electrons into a single covalent bond, depicted on the right as the area where the gray clouds around each hydrogen atom overlap. In the covalent bond, the electron pair is shared between the two hydrogen atoms. When the covalent bond is formed, we no longer have two separate hydrogen atoms but instead a single molecule of hydrogen—H2. Image credit: Wikipedia, CC BY-SA 3.0
When atoms combine by forming covalent bonds, the resulting collection of atoms is called a molecule. We can therefore say that a molecule is the simplest unit of a covalent compound. As we will now see, there are a variety of different ways to represent and draw molecules.

Representing molecules: chemical formulas

Chemical formulas, sometimes also called molecular formulas, are the simplest way of representing molecules. In a chemical formula, we use the elemental symbols from the periodic table to indicate which elements are present, and we use subscripts to indicate how many atoms of each element exist within the molecule. For example, a single molecule of NH3, ammonia, contains one nitrogen atom and three hydrogen atoms. By contrast, a single molecule of N2H4, hydrazine, contains two nitrogen atoms and four hydrogen atoms.
Concept check: The chemical formula for acetic acid, a common acid found in vinegar, is C2H4O2. How many oxygen atoms are there in three molecules of acetic acid?
As your study of chemistry continues, you will find that sometimes chemists write molecular formulas in different ways. For example, as we just saw, the chemical formula for acetic acid is C2H4O2; however, we will often see it written as CH3COOH. The reason for this second type of formula is that the order in which the atoms are written helps to show the structure of the acetic acid molecule—this is sometimes called the condensed structural formula. As such, we can think of CH3COOH as being like a cross between a chemical formula and a structural formula, which we will consider next.

Representing molecules: structural formulas

Chemical formulas only tell us how many atoms of each element are present in a molecule, but structural formulas also give information about how the atoms are connected in space. In structural formulas, we actually draw the covalent bonds connecting atoms. In the last section, we looked at the chemical formula for ammonia, which is NH3. Now, let’s consider its structural formula:
Two structural formulas for ammonia, NH3. The formula on the left gives only a two-dimensional approximation of molecular structure, whereas the formula on the right shows the orientation of atoms in space using dashes going into the plane of the page and wedges coming out of the plane of the page. The two dots on nitrogen in the right formula indicate a lone pair of electrons. Image credit: left, Physique Applique, CC BY-NC-SA 4.0; right, Wikipedia, CC BY-SA 3.0
From both of these structural formulas, we can see that the central nitrogen atom is connected to each hydrogen atom by a single covalent bond. Keep in mind, however, that atoms and molecules, just like everything else in the universe, exist in three dimensions—they have length and width, as well as depth. In the structural formula to the left, we are only seeing a two-dimensional approximation of this molecule. However, in the more detailed structural formula on the right, we have a dashed line to indicate that the rightmost hydrogen atom is sitting behind the plane of the screen, while the bold wedge indicates that the center hydrogen is sitting out in front of the plane of the screen. The two dots above nitrogen indicate a lone pair of electrons that are not involved in any covalent bond. We will discuss the significance of these electrons at the end of this section. To help show this three-dimensional shape even more accurately, we can rely on space-filling models as well as ball-and-stick models. Let's consider both of these models for NH3:
A space-filling model, left, and a ball-and-stick model, right, for ammonia, NH3. Nitrogen atoms are depicted in blue, and hydrogen atoms are depicted in white. Image credit: left, Wikipedia; right, Wikipedia, public domain
The left-hand image shows the space-filling model for ammonia. The nitrogen atom is depicted as the larger, central blue sphere, and the three hydrogen atoms are depicted as the smaller white spheres off to the sides, which form a kind of tripod. The overall shape of the molecule is a pyramid with nitrogen at the vertex and a triangular base formed by the three hydrogen atoms. As you will learn when you study molecular shapes and molecular geometry, this type of arrangement is known as trigonal pyramidal. The main advantage of the space-filling model is that it gives us a sense of the relative sizes of the different atoms—nitrogen has a larger atomic radius than hydrogen.
The right-hand image shows us the ball-and-stick model for ammonia. As you might be able to guess, the balls represent the atoms, and the sticks that connect the balls represent the covalent bonds between the atoms. The advantage of this type of model is that we get to see the covalent bonds, which also allows us to more easily see the geometry of the molecule.

Ions and ion formation

Now that we have an understanding of covalent bonds, we can begin to discuss the other major type of chemical bond—an ionic bond. Unlike covalent bonds, in which electron pairs are shared between atoms, an ionic bond is formed when two oppositely charged ions attract one another. To better illustrate this, we first need to examine the structure and formation of ions.
Recall that neutral atoms have an equal number of protons and electrons. The result of this is that the total positive charge of the protons exactly cancels the total negative charge of the electrons, so that the atom itself has an overall charge, or net charge, of zero.
However, if an atom gains or loses electrons, the balance between protons and electrons is upset, and the atom becomes an ion—a species with a net charge. Let’s first look at what happens when a neutral atom loses an electron:
A neutral sodium atom, Na, loses one electron to form a cation, Na+. Image credit: Introduction to Chemistry: General, Organic, and Biological, CC BY-NC-SA 3.0
In the diagram above, we see a neutral atom of sodium, Na, losing an electron. The result is that the sodium ion, Na+, has 11 protons, but only 10 electrons. Thus, the sodium ion has a net charge of 1+, and it has become a cation—a positively charged ion.
Next, we’ll look at the formation of an anion—an ion with a net negative charge.
A neutral chlorine atom, Cl, gains an electron to form an anion, Cl . Image credit: Introduction to Chemistry: General, Organic, and Biological, CC BY-NC-SA 3.0
In this diagram, we see the opposite process of what we saw with the sodium atom. Here, a neutral chlorine atom, Cl, is gaining an electron. The result is that the newly formed chloride ion, Cl, has 17 protons and 18 electrons. Because electrons carry a 1- charge, the net charge on the chloride ion from the extra electron is 1-. It has become an anion, or a negatively charged ion.
Note: When neutral atoms gain electron(s) to form anions, they are typically named with an -ide suffix. For example, Cl is chloride, Br is bromide, O2 is oxide, N3 is nitride, etc.

Ionic bonds

In the last section, we looked separately at how sodium can lose an electron to form the cation Na+ and at how chlorine can gain an electron to form the anion Cl. In reality, however, this process can occur all in one step when sodium gives its electron away to chlorine! We can illustrate this as follows:
Sodium donates its electron to chlorine to form Na+ and Cl. Image credit: Boundless Learning, CC BY-SA 4.0
Here, we can see how an electron is transferred from sodium to chlorine in order to form the ions Na+ and Cl. Once these ions are formed, there is a strong electrostatic attraction between them, which leads to the formation of an ionic bond. We can see that one of the major distinguishing factors between ionic bonds and covalent bonds is that in ionic bonds, electrons are completely transferred, whereas in covalent bonds, electrons are shared.
Note: As you learn more about bonding, you will see that in actuality, the difference between covalent and ionic bonds is not black and white and that the two types of bonds are actually more like the two ends of a common spectrum. We can think of a pure ionic bond as having a perfectly unequal sharing of electrons, whereas a pure covalent bond has a perfectly equal sharing of electrons. In reality, however, most chemical bonds lie somewhere in between these two cases.

Drawing ionic bonds

We will now consider the different ways we can draw or depict ionic bonds. We will continue looking at the most commonly known ionic compound—sodium chloride, which is best known as table salt. A single ionic bond in sodium chloride can be shown as follows:
A structural drawing showing an ionic bond between a sodium cation, Na+, and a chloride anion, Cl. Note that there is no single line connecting the two ions because that would indicate shared electrons in a covalent bond. Here, electrons have been transferred completely, and the bond is purely ionic. Image credit: Wikispaces, CC BY-SA 3.0
The positively charged sodium cation and the negatively charged chloride anion like to position themselves next to each other due to their mutual electrostatic attraction. Because no electrons are shared, we don’t depict an ionic bond with a line as we do for covalent bonds. We simply recognize that the attraction is there due to the opposite charge signs on the ions.
The above diagram, however, is just a model. In nature, sodium chloride does not exist as a single sodium cation bonded with a single chloride anion. As we mentioned earlier, sodium chloride is table salt—and if we were able to use a super-powered microscope that could examine table salt at the atomic level, we would see something like the following structure:
If we were to examine a crystal of sodium chloride at the atomic level, we would see sodium ions and chloride ions evenly positioned next to one another in space. The orderly, stable structure is due to the strong ionic bonds between Na+ and Cl . Image credit: Introduction to Chemistry: General, Organic, and Biological, CC BY-NC-SA 3.0
We can see from this diagram that the Na+ and Cl ions naturally position themselves next to one another in space due to the shared electrostatic attractions between them. The ions are then held in place by their very strong ionic bonds. The above structure is known as a crystal lattice, and sodium chloride—like most ionic compounds—is a crystalline solid. You will learn more about this in future lessons on the different types of solids.

Covalent vs. ionic compounds: molecules vs. formula units

Now that we’ve discussed the basics of both covalent and ionic bonding, we need to draw a few necessary distinctions. We know that a group of atoms joined by only covalent bonds is known as a molecule. It should be noted, however, that the word molecule should only be used in reference to covalent compounds. In an ionic compound, such as sodium chloride, there is no such thing as a single molecule of sodium chloride since, in reality, sodium chloride is actually made up of multiple sodium and chloride ions joined together in a large crystal lattice—as we saw in the previous diagram. As such, we refer to one piece of NaCl not as a molecule but as a formula unit. Keep in mind that single formula units, unlike single molecules, largely do not exist in nature—we simply rely on formula units for ease of reference and convenience.
Concept check: Which type of compounds are composed of molecules—ionic or covalent?


All chemical bonding is due to electrostatic attraction. When atoms combine through chemical bonding, they form compounds—unique structures composed of two or more atoms. The basic composition of a compound can be indicated using a chemical formula. A chemical formula uses symbols from the periodic table to indicate the types of elements present in a particular compound while using subscripts to represent the number of each type of element present.
Compounds can be covalent or ionic. In covalent compounds, atoms form covalent bonds that consist of electron pairs shared between two adjacent atomic nuclei. An example of a covalent compound is ammonia. The chemical formula of ammonia is NH3, which tells us that in a single molecule of ammonia, there is one nitrogen atom, and three hydrogen atoms. The structure of a covalent compound can be depicted through space-filling models as well as ball-and-stick models.
In ionic compounds, electrons are completely transferred from one atom to another so that a cation—positively charged ion—and an anion—negatively charged ion—form. The strong electrostatic attraction between adjacent cations and anions is known as an ionic bond. The most common example of an ionic compound is sodium chloride NaCl, better known as table salt. Unlike covalent compounds, there is no such thing as a molecule of an ionic compound. This is because in nature NaCl does not exist in individual units, but in crystal lattice structures that are composed of multiple Na+ and Cl ions alternating in space. The chemical formula NaCl specifies one formula unit of this compound.

Want to join the conversation?

  • male robot johnny style avatar for user akhileshmulgund10
    Here, electrons and protons are depicted using spheres. But in reality, protons and electrons aren't really spheres, are they? If not, what exactly do they look like?
    (172 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user EnchantressQueen
      It makes sense for protons and electrons to be spheres since the shape would allow the mass of the particles to be evenly distributed from all sides. If they were cubes, the corners would be sticking farther away from the center.

      However, it is much more complicated than that. Sometimes the protons and electrons act like waves. They are not really spheres, but at the same time, they are.

      Pretend you are holding a ball above a puddle of water. Now, drop the ball. When the ball hits the water, it disappears. The ripples travel outward from the point of impact. Then, a ripple hits a stick in the water. The ripples disappear, and the ball bounces back up from the stick.

      Hopefully this answer is simple enough yet understandable at the time. If you are still interested in this topic, I suggest you look further into quantum physics.

      Remember that I might be wrong. Anything that we think are facts may be later disproven. That is the beauty of science. :)

      Anyone have any other thoughts on this?
      (87 votes)
  • blobby green style avatar for user hossein noroozian
    when NaCl crystal dissolves in water , what happens to it? what happens to electrostatic attraction between Na and Cl atoms?
    (72 votes)
    Default Khan Academy avatar avatar for user
    • spunky sam blue style avatar for user Ernest Zinck
      The electrostatic attraction between the Na⁺ ions and the Cl⁻ ions is still there.
      But the attractions between these ions and water molecules is greater than their attractions for each other.
      The ions become surrounded by a shell of water molecules and move away from the crystal and into the water.
      (113 votes)
  • aqualine seed style avatar for user Ellie Cook
    How does bonding (covalent vs ionic) determine the properties of a substance?
    (39 votes)
    Default Khan Academy avatar avatar for user
    • male robot donald style avatar for user johnny
      Do you know what properties from these bonds make that happen ? I remenber seeing in another video that intermolecular h-bonds typically make for high boiling points, like in water, because it takes alot of energy to break them apart. I would think covalent bonds would be even stronger and therefore harder to change phase. But maybe what matters for boiling is different than for melting, do you know how these bonds translate into the properties you cited ?
      (12 votes)
  • duskpin ultimate style avatar for user 'phiakat
    Is it possible for a molecule to lose all of it's electrons? Hydrogen for example?
    (29 votes)
    Default Khan Academy avatar avatar for user
  • spunky sam blue style avatar for user Scott Burgandy Stephen
    Is there a limit to the number of electrons atoms can have, or is it specific to each element?
    (18 votes)
    Default Khan Academy avatar avatar for user
    • old spice man green style avatar for user Matt B
      Each shell is limited to the number of electrons per subshell:
      The first shell consists of an s-orbital, and so it will have max 2 electrons.
      The second shell has an s and p orbital so it will have max 2+6=8 electrons.
      The third shell has s p and d orbitals so it will have max 2+6+10=18 electrons.
      (30 votes)
  • male robot donald style avatar for user Atomic
    bro Richard carries the chat forever
    (32 votes)
    Default Khan Academy avatar avatar for user
  • aqualine seed style avatar for user Christine  Yan
    Does the bond really exist and you can observe, or its a only an illustration of a kind of force within compound?
    (18 votes)
    Default Khan Academy avatar avatar for user
  • stelly orange style avatar for user Megane Thomas
    I still don't understand how there is no such thing as a molecule of an ionic compound. Earlier in the chemistry playlist, they said that a molecule consists of two or more atoms bonded together, so wouldn't that make ionically bonded sodium and chlorine a molecule cause it consists of two atoms? And how much of it do you need in order for it to be considered a formula unit?
    (9 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user tyersome
      Molecules are defined as two or more atoms connected by covalent bonds.

      That might seem arbitrary (especially since covalent and ionic bonds are ends of a continuum rather than separate categories), but ionic bonding is fundamentally different.

      Ionic bonding is not directional — for example, each sodium cation in a crystal of table salt is equally attracted to all the neighboring chloride anions. In contrast, covalent bonding is directional — a covalent bond is between two specific atoms.

      This means that a salt crystal has a network of interactions, so there are no specific pairs of ions — this means you can't single out a "molecule" and therefore we talk about the more abstract "formula units" instead. Formula units have no physical reality, they are just a way of talking about the stoichiometry (ratio of elements) within a compound.

      Does that help?
      (34 votes)
  • mr pink red style avatar for user So Yeon Kim
    In the "Ion and formation" part, can every elements form an ion?
    (14 votes)
    Default Khan Academy avatar avatar for user
    • leafers seedling style avatar for user Eliane Leal
      Elements tend to try and reach more stable electronic distribuitions, therefore they can loose or win electrons, forming ions, not all elements form ions spontaneously, like noble gases, some form ions very very easily while others dont (they require high amounts of energy to do so)
      (20 votes)
  • primosaur seed style avatar for user soumilighosh246
    I have this question since the beginning and unfortunately nothing seems to clarify it.
    What is the difference between a molecule and a compound?
    (5 votes)
    Default Khan Academy avatar avatar for user