Which Compound Contains Both Ionic and Covalent Bonds?

Compounds that contain both ionic and covalent bonds are those built around polyatomic ions, groups of atoms bonded together by shared electrons that carry an overall electrical charge. Common examples include sodium hydroxide (NaOH), potassium nitrate (KNO₃), calcium carbonate (CaCO₃), and ammonium chloride (NH₄Cl). Any time you see a metal paired with a cluster of nonmetals in a chemical formula, you’re almost certainly looking at a compound with both bond types.

How Both Bond Types Exist in One Compound

The key to understanding these compounds is the polyatomic ion. A polyatomic ion is a group of atoms that share electrons with each other (covalent bonding) but collectively carry a positive or negative charge. That charged group then attracts an oppositely charged ion through electrostatic force (ionic bonding). So the covalent bonds hold the cluster together on the inside, while the ionic bond connects that cluster to the rest of the compound on the outside.

Take sodium hydroxide (NaOH) as a clear example. Inside the hydroxide group (OH⁻), the oxygen and hydrogen atoms share one pair of electrons, forming a covalent bond. That hydroxide group carries a negative charge, which attracts the positively charged sodium ion (Na⁺). The bond between Na⁺ and OH⁻ is ionic. One compound, two bond types.

The Most Common Examples

These compounds show up constantly in everyday chemistry. Here are some of the most widely encountered ones:

  • Sodium hydroxide (NaOH): Covalent O-H bond inside the hydroxide ion, ionic bond between Na⁺ and OH⁻. Found in drain cleaners and soap-making.
  • Potassium nitrate (KNO₃): The nitrate ion (NO₃⁻) has three covalent nitrogen-oxygen bonds arranged in a flat, triangular shape, all with identical bond lengths of 1.26 Å. The potassium ion (K⁺) bonds ionically to the nitrate group. Used in fertilizers and fireworks.
  • Calcium carbonate (CaCO₃): Covalent carbon-oxygen bonds inside the carbonate group, ionic interaction between calcium and the carbonate ion. This is limestone, chalk, and the main component of eggshells.
  • Ammonium chloride (NH₄Cl): The ammonium ion (NH₄⁺) contains four covalent nitrogen-hydrogen bonds. In solid form, ammonium and chloride ions arrange themselves in an ionic lattice. There is no covalent bond between nitrogen and chlorine.
  • Ammonium nitrate (NH₄NO₃): Both the ammonium cation and nitrate anion contain internal covalent bonds, and the two ions are held together ionically. Widely used as fertilizer.
  • Sodium cyanide (NaCN): The cyanide ion (CN⁻) features a carbon-nitrogen triple bond, one of the strongest covalent bonds in chemistry. The sodium cation bonds to it ionically.
  • Magnesium sulfate (MgSO₄): The sulfur-oxygen bonds inside the sulfate ion are covalent, while the magnesium-oxygen interactions have a distinctly ionic character. This is Epsom salt.
  • Potassium sulfate (K₂SO₄): Two potassium ions bond ionically to one sulfate group containing four covalent S-O bonds.
  • Strontium nitrate (Sr(NO₃)₂): Same pattern as potassium nitrate but with a strontium cation. Used to produce red color in flares.
  • Magnesium hydroxide (Mg(OH)₂): Two hydroxide ions, each with a covalent O-H bond, attached ionically to one magnesium ion. This is the active ingredient in milk of magnesia.

The Ammonium Ion Is a Special Case

Most of these compounds follow a simple pattern: metal cation plus polyatomic anion. But the ammonium ion (NH₄⁺) flips the script. It’s a polyatomic cation, a positively charged group of nonmetals. The ammonium ion forms when a hydrogen ion (H⁺) attaches to the lone electron pair on an ammonia molecule (NH₃), creating a fourth nitrogen-hydrogen bond called a coordinate covalent bond. Once formed, all four N-H bonds are identical.

This means a compound like ammonium nitrate has covalent bonds on both sides of the ionic bond. The NH₄⁺ ion is covalently bonded internally, the NO₃⁻ ion is covalently bonded internally, and the attraction between them is ionic.

How to Spot These Compounds in a Formula

You can identify a compound with both bond types by looking at its chemical formula and applying a few straightforward checks:

First, look for a metal combined with a group of nonmetals. If you see something like Na paired with OH, or K paired with NO₃, that’s your signal. The metal forms the ionic bond, and the nonmetal group contains covalent bonds. Second, look for the ammonium ion (NH₄). Any compound starting with NH₄ paired with a negative ion (Cl⁻, NO₃⁻, SO₄²⁻) contains both bond types.

The underlying principle comes down to electronegativity, how strongly an atom pulls on shared electrons. When two atoms have a very large electronegativity difference (greater than about 2.1 on the Pauling scale), the bond between them is ionic. One atom essentially takes the electron rather than sharing it. When the difference is smaller, the atoms share electrons and the bond is covalent. In compounds with polyatomic ions, both situations happen at once: the nonmetal atoms within the ion have small electronegativity differences (covalent sharing), while the metal and the polyatomic ion have a large difference (ionic transfer).

Why Pure Ionic and Pure Covalent Are the Exception

It’s worth noting that “ionic” and “covalent” are really two ends of a spectrum rather than strict categories. A bond with an electronegativity difference of zero is perfectly nonpolar covalent. As that difference increases, the bond becomes polar covalent, meaning the electrons are shared unequally. Past a difference of roughly 2.1, the bond is classified as ionic. The sulfur-oxygen bonds in a sulfate ion, for instance, are polar covalent. The bonds between magnesium and oxygen in magnesium sulfate show clearly ionic character. Most real compounds live somewhere along this continuum.

For classroom and exam purposes, though, the rule is simple: if a compound contains a polyatomic ion, it has both ionic and covalent bonds. That covers any salt built from groups like hydroxide (OH⁻), nitrate (NO₃⁻), sulfate (SO₄²⁻), carbonate (CO₃²⁻), phosphate (PO₄³⁻), cyanide (CN⁻), or ammonium (NH₄⁺). These are among the most common compounds in chemistry, so the combination of both bond types is far more typical than most students expect.