Skip to content
ScienceQuest
Chemistry Visualiser School

Lewis Structure Generator

Lewis structure generator with steps: type a formula or ion such as NO₃⁻ or SO₄²⁻ and get formal charges, every resonance form and the 3D VSEPR shape.

Visualiser

1−

Put a charge at the end, as in NO3-, SO4^2- or [NH4]+. Salts such as NaCl are drawn as ions.

Tap a bond to raise its order, or hold it to lower it. ← and → pick a bond, ↑ and ↓ change it, Escape resets. Space plays and pauses.

Step 7 of 7 Formal charges and resonance

Formal charge of each kind of atom: valence electrons, less nonbonding electrons, less half the bonding electrons
AtomVNB/2FC
N504+1
double-bonded O6420
single-bonded O ×2661−1

They add up to −1, the ion’s charge. Three equivalent forms differ only in where the electrons are, so the real ion is their average.

Resonance 3 equivalent

On average: bond order 4/3; charges N +1, O −2/3 ×3.

Tap a form to draw it. Only electrons move between them, never atoms.

3D shape AX₃

Trigonal planar

Drag to turn it, or use the arrow keys. Space plays and pauses.

NO₃⁻, nitrate. Bonds: N=O, N−O, N−O. N: 0 lone pairs, formal charge +1. O: 2 lone pairs, formal charge 0. O: 3 lone pairs, formal charge −1. O: 3 lone pairs, formal charge −1. 3 equivalent resonance forms; this is form 1.

Valence electrons
Valence electrons: N 5 and each O 6, and the 1− charge adds 1. 5 + 3 × 6 + 1 = 24.
24
Central atom
N goes in the middle: N is the least electronegative atom other than H, χ 3.04 against 3.44 for O. Checked the other way, O in the middle would need an O−O bond, and electronegative atoms of one element avoid bonding to each other when they can.
N
Bond and lone pairs
4 pairs in bonds and 8 lone pairs: 8 + 16 = 24 electrons.
4 and 8
Formal charges
Formal charge is V − N − B/2, valence electrons less nonbonding electrons less half the bonding ones. N: 5 − 0 − 4 = +1. The double-bonded O: 6 − 4 − 2 = 0. Each single-bonded O: 6 − 6 − 1 = −1. They add up to −1, the overall charge. There are 3 equivalent forms, differing only in where the electrons are, so the real ion is their average.
N +1, O 0, O −1 ×2
Resonance forms
Every assignment of bonds at the best score.
3 equivalent
Average bond order
Each bond’s order averaged over the equivalent forms, exactly, as a fraction.
4/3
Shape
3 σ bonds and 0 lone pairs round N: electron geometry trigonal planar.
AX₃ trigonal planar
Octet status
Complete: every atom but H has eight. Incomplete: an atom left with fewer, as boron is in BF₃. Expanded: an atom from period 3 on with more. Radical: an odd electron.
complete
Polarity, an estimate
An ion carries a net charge, so whether its bonds cancel is not the question polarity asks.
an ion
Parameters

Auto takes the best score, ties going to the less electronegative atom. Any other choice is drawn with its cost.

Most general chemistry homework minimises formal charge, which gives sulfate two S=O bonds. Octets first keeps every atom to eight where it can, which gives sulfate four single bonds and S at +2.

Each atom’s valence electrons less its nonbonding electrons less half its bonding ones: V − N − B/2.

Every electron marked by the atom it came from: dots for one element, crosses for the other, colours when there are more, as UK courses draw them.

The average of the equivalent forms: dashed partial bonds and fractional charges.

Citing this tool

Last updated . Add the date you accessed it as well, which a citation of a page that can change asks for. If a specific result matters, cite the permalink from the tool’s share row instead of this page: it reproduces the exact parameters.

On the syllabus: AP Chemistry, Unit 2: Compound Structure and Properties; MCAT, 5B: Nature of molecules and intermolecular interactions.

Teaching with this? You can put it on a class page or LMS for free, with no ads inside the frame. Get the embed code.

The equation

FC=V−N−B2\text{FC} = V - N - \tfrac{B}{2}

Formal charge, OpenStax Chemistry 2e (2019), section 7.4

How do you draw a Lewis dot structure?

To draw a Lewis structure: count the valence electrons of all the atoms (adjusted for the charge of an ion), place the least electronegative atom other than hydrogen in the centre, form single bonds to the terminal atoms, distribute the remaining electrons as lone pairs to satisfy the octet rule (or duet for hydrogen), and form double or triple bonds if the central atom’s octet is incomplete.

A Lewis structure accounts for every valence electron in a molecule or ion, as shared pairs between atoms and lone pairs on them. The method has seven steps, and the generator runs them for any molecule or polyatomic ion you type. Here they are for the nitrate ion, NO₃⁻, the structure the tool opens on.

  1. Count the valence electrons. Nitrogen is in group 15 of the periodic table and brings 5, each oxygen is in group 16 and brings 6, and the 1− charge adds one more: 5 + 3 × 6 + 1 = 24.
  2. Choose the central atom. Hydrogen never goes in the middle, and otherwise it is usually the least electronegative atom. Nitrogen’s electronegativity is 3.04 on the Pauling scale against oxygen’s 3.44, so N goes in the middle with the three O atoms round it.
  3. Join the atoms with single bonds. Three bonds use 3 × 2 = 6 electrons, leaving 24 − 6 = 18.
  4. Complete the outer atoms. Each oxygen takes three lone pairs to reach eight: 3 × 6 = 18, leaving nothing.
  5. Put the rest on the central atom. Nothing is left, so nitrogen has only the 6 electrons of its three bonds.
  6. Make multiple bonds where needed. One oxygen lone pair moves into its bond, making N=O, and nitrogen now has 8.
  7. Check the formal charges. Nitrogen comes out at +1, the double-bonded oxygen at 0 and each single-bonded oxygen at −1, which add up to −1, the ion’s charge. Any of the three oxygens could have had the double bond, so nitrate has three equivalent resonance forms.

Tap a step in the bar under the drawing, or press Play, to watch each one happen. The electrons start beside the atoms that brought them, and every one of the 24 can be followed to the bond or lone pair it ends in. The method is the one OpenStax Chemistry 2e sets out in sections 7.3 and 7.4. Each of the commonest species has a page of its own, with the generator’s structure and its working, in Lewis structures of 78 common molecules and ions.

Formal charge

Formal charge compares the electrons an atom has in the structure with the electrons it brought, counting each bond as shared equally: FC = V − N − B/2, where V is the atom’s valence electrons, N its nonbonding electrons and B its bonding electrons. In nitrate the nitrogen has no lone pairs and four bonding pairs, so its formal charge is 5 − 0 − 4 = +1. A single-bonded oxygen has three lone pairs and one bond, 6 − 6 − 1 = −1, and the double-bonded oxygen has two lone pairs and two bonding pairs, 6 − 4 − 2 = 0.

The formal charges always add up to the overall charge, which makes a quick check on any structure. They are bookkeeping rather than real charges. In carbon monoxide, C≡O, they are −1 on carbon and +1 on oxygen, the reverse of what oxygen’s higher electronegativity suggests, because one of the three shared pairs came from oxygen alone. A formal charge is not an oxidation state either: nitrate’s nitrogen has a formal charge of +1 and an oxidation state of +5.

Formal charges decide between structures where the octet rule cannot. A smaller total is better, and so is having fewer atoms charged by 2 or more; charges of the same sign on bonded atoms are worse; giving more atoms an octet is better; and a negative charge belongs on the more electronegative atom. The generator applies those rules in that order to every arrangement of bonds it tries, so ties are found rather than guessed. That is why the metaborate ion, BO₂⁻, is [O=B=O]⁻, like carbon dioxide, rather than [O=B−O]⁻ with boron at six.

Which atom goes in the middle

The least electronegative atom usually goes in the middle, and hydrogen never does, since it holds only two electrons and so makes one bond. A halogen goes in the middle only when the atoms bonded to it, other than hydrogen, are at least as electronegative, as in ClF₃ and ClO₄⁻. Where the choice is still unclear, the generator tries every candidate and keeps the best. Pick another centre from the Central atom menu and it draws that structure instead, with its cost.

Nitrous oxide, N₂O, is the classic case. Oxygen appears once, which makes it look like the middle atom, but with O in the middle the formal charges add up to 4, against 2 with N in the middle, so the molecule is N−N−O. Its best form is N≡N⁺−O⁻.

Dichlorine monoxide, Cl₂O, goes the other way. Chlorine is the less electronegative of the two, 3.16 against 3.44, but with Cl in the middle the molecule needs a Cl−Cl bond and puts 10 electrons round the middle chlorine. With O in the middle, Cl−O−Cl gives every atom an octet and no formal charge, and that is the molecule. Electronegative atoms of one element avoid bonding to each other whenever the formula gives them a choice, which is also why the chlorite ion is O−Cl−O⁻ and not Cl−O−O⁻.

The same comparison puts carbon in the middle of hydrogen cyanide, H−C≡N, with no formal charges at all, where H−N≡C would cost 2. Acids written with hydrogen first, such as HNO₃ and H₂SO₄, have each H on its own O, which is how oxyacids are built, and the generator relies on that convention of writing: CH₂O, written carbon first, keeps its hydrogens on carbon. A formula that brackets its OH groups, such as B(OH)₃ or Al(OH)₄⁻, puts each H on its own O too. When one element appears twice and the rest split evenly, the two bond to each other: ethene, C₂H₄, is H₂C=CH₂, and hydrogen peroxide, H₂O₂, is H−O−O−H. How the two ends then turn about the bond joining them is the question the Newman projection explorer answers.

Resonance and the resonance hybrid

When more than one arrangement of electrons scores equally well, each is a resonance form, and the real molecule is one structure that is their average, not something that flips between them. Nitrate has three equivalent forms. Averaged over them each N−O bond has an order of (2 + 1 + 1)/3 = 4/3 and each oxygen a formal charge of (0 − 1 − 1)/3 = −2/3, and all three N−O bonds are measured to be the same length. Turn on Show the resonance hybrid to see it drawn with dashed partial bonds and fractional charges.

The carbonate ion, CO₃²⁻, has three forms too, with carbon at 0, so each C−O bond is again 4/3 and each oxygen −2/3. Ozone, O₃, has two, with the central oxygen at +1, so its bond order is 3/2 and each end oxygen carries −1/2. Its two bonds are the same length, between those of a single and a double O−O bond.

When Play cycles the forms, the curved arrows show how one becomes the next: a lone pair on one oxygen swings into its bond to make a π bond, while the π bond on the other side swings out onto its oxygen as a lone pair. Only electrons move; the atoms stay where they are. After the equivalent forms the strip lists minor contributors, the next best structures by the same rules, such as the two N≡N−N forms of the azide ion, N₃⁻. They have the same total formal charge as [N=N=N]⁻, 3, but each puts −2 on one nitrogen, so they count for less.

When the octet rule bends

Some species cannot give every atom eight electrons, and a Lewis structure shows each one honestly rather than forcing it.

Too few electrons. In boron trifluoride, BF₃, boron is left with 6. A B=F double bond would complete its octet only by putting +1 on fluorine, the most electronegative element, so BF₃ is drawn with three single bonds and every formal charge at 0. Beryllium in BeCl₂ is left with 4, and carbon in a carbene such as dichlorocarbene, CCl₂, with 6: two bonds and a lone pair. Taking a pair from somewhere else completes the octet: the tetrafluoroborate ion, BF₄⁻, has boron at 8, with a formal charge of −1.

An odd number. Nitrogen monoxide, NO, has 11 valence electrons and nitrogen dioxide, NO₂, has 17, so one is always unpaired. Most textbooks put it on nitrogen, the less electronegative atom, and so does this tool: NO is N=O with 7 electrons round the nitrogen and no formal charges, and NO₂ has two forms with nitrogen at +1 and the single-bonded oxygen at −1. Some courses put NO₂’s odd electron on an oxygen instead, which removes the formal charges. Neither picture is the whole truth, because the electron is really spread over the molecule.

More than eight. Atoms from period 3 on can hold more than eight electrons round them in a Lewis structure. Phosphorus has 10 in PCl₅, sulfur has 12 in SF₆, and xenon has 12 in XeF₄, four bonds and two lone pairs. Atoms of period 2 never do: five bonds to nitrogen is always wrong, which is why the generator rejects any structure that needs it.

The sulfate question. Sulfate, SO₄²⁻, has two defensible Lewis structures, and courses differ on which they want. Minimising formal charge gives two S=O bonds and two S−O⁻ bonds, with sulfur at 0, 12 electrons round it and six equivalent forms. Keeping every atom to an octet gives four single bonds, with sulfur at +2 and each oxygen at −1, and one form. The Convention switch draws both. Quantum chemical studies, such as Reed and Weinhold’s of SF₆ in 1986, find that sulfur’s d orbitals take only a minor part in its bonding, which supports the polar single-bond picture; most general chemistry homework still expects the double bonds. Phosphate, PO₄³⁻, and perchlorate, ClO₄⁻, split the same way: phosphorus comes out at 0 or +1, and chlorine at 0 or +3.

Ionic compounds

A compound of a group 1 metal, of a group 2 metal other than beryllium, or of aluminium with oxygen, fluorine or a polyatomic ion is drawn as ions, and so is a salt of ammonium. The metal gives its outer electrons to the non-metal, and each ion goes in square brackets with its charge outside. Beryllium’s compounds are covalent, so BeCl₂ is drawn as a molecule, and so is aluminium chloride, AlCl₃. Sodium chloride is [Na]⁺, with no outer electrons, and [Cl]⁻, with eight. Magnesium oxide is Mg²⁺ and O²⁻, two electrons having moved, and calcium fluoride is Ca²⁺ and two F⁻. Switch on Dot-and-cross and the electrons the anion gained show as the metal’s crosses.

A polyatomic ion keeps its own covalent bonds inside its brackets. Sodium sulfate is 2 Na⁺ and SO₄²⁻, and the sulfate is the same structure, with the same six resonance forms, as on its own; ammonium chloride is NH₄⁺ and Cl⁻. Salts are split into the one-atom ions and the ions of the polyatomic ions list whose charges balance. Charges are written the way the chemical equation balancer reads them, SO4^2-, so an ion drawn here can be carried straight into an equation.

From Lewis structure to 3D shape

A Lewis structure is flat, but it tells you the shape. Count the electron domains round the central atom, its σ bonds and its lone pairs, with a double or triple bond counting once, and write them as AXₙEₘ: n bonded atoms and m lone pairs. Water is AX₂E₂, two bonds and two lone pairs arranged tetrahedrally, so it is bent. Nitrate is AX₃, trigonal planar. Sulfur tetrafluoride is AX₄E₁, a see-saw, and xenon tetrafluoride is AX₄E₂, square planar.

The 3D shape panel beside the resonance forms turns the shape in three dimensions, and Open in the VSEPR viewer opens the VSEPR molecular geometry tool on the same class, where the shape can be compared with its neighbours. An odd electron counts as a domain too, though it pushes less than a pair: nitrogen dioxide is AX₂E₁ and bent, opening to 134°, and the methyl radical is flat.

What a Lewis structure cannot tell you

Oxygen is the famous failure. The best Lewis structure of O₂, O=O with two lone pairs on each atom, pairs all 12 valence electrons, yet liquid oxygen clings to the poles of a magnet, because O₂ has two unpaired electrons. Only a molecular orbital diagram explains them: the last two electrons go one each into two π* orbitals of equal energy. The same diagram describes B₂ and C₂, which the generator refuses: they have too few electrons to give both atoms an octet, and the diagram gives them bond orders of 1 and 2.

Transition metals are refused rather than guessed at. Their bonding uses d orbitals, and the octet rule that every step relies on does not hold for them: permanganate, MnO₄⁻, and dichromate, Cr₂O₇²⁻, need more than a Lewis structure. The electron configuration calculator works out their d electrons instead.

A formula alone also does not fix how a larger molecule is joined up. C₂H₆O is both ethanol, CH₃CH₂OH, and dimethyl ether, CH₃OCH₃, so the generator draws molecules with one central atom, or two identical ones bonded to each other, and refuses the rest with the reason. Diborane, B₂H₆, is refused because each of its two B−H−B bonds holds one pair of electrons over three atoms, which no structure of two-centre bonds can show. A Lewis structure gives no bond angles or bond lengths either: the shape comes from VSEPR, and the numbers from measurement.

Common mistakes

  • Forgetting the charge. An anion adds electrons and a cation removes them: nitrate has 24 valence electrons, not 23, and ammonium has 8, not 9.
  • Putting hydrogen in the middle. Hydrogen makes one bond, so it is always on the outside.
  • Giving a period 2 atom more than eight. Carbon, nitrogen, oxygen and fluorine never exceed an octet. Only atoms from period 3 on expand theirs.
  • Treating resonance forms as different molecules. They are one molecule drawn several ways. Nitrate does not switch between three structures; each of its bonds is always 4/3.
  • Moving atoms between resonance forms. Only electrons move. Moving an atom makes a different molecule.
  • Confusing formal charge with oxidation state. Nitrogen in nitrate has a formal charge of +1 and an oxidation state of +5. The first shares every bond equally; the second gives each bond to the more electronegative atom.
  • Counting a double bond as two domains. For the shape, a double or triple bond is one domain, so carbon dioxide is AX₂ and linear.
Lewis Structure Generator: the equation FC = V - N - B/2.
The equation the visualiser is built on, with its source. Image © ScienceQuest, CC BY 4.0. Free to reuse with credit and a link to this page; how to reuse it. Download PNG

Common questions

How do you draw a Lewis structure step by step?

Count the valence electrons (for nitrate, 5 + 3 × 6 + 1 = 24), put the least electronegative atom in the middle, join the atoms with single bonds (6 electrons), give the outer atoms octets (18 more), put anything left over on the central atom (nothing here), then turn outer lone pairs into double bonds until the centre has eight, and check the formal charges. Nitrate ends with one N=O bond, two N−O bonds, nitrogen at +1 and three equivalent resonance forms.

How do you calculate formal charge?

Take the valence electrons, subtract the nonbonding electrons, and subtract half the bonding electrons: FC = V − N − B/2. In nitrate the nitrogen is 5 − 0 − 4 = +1, each single-bonded oxygen is 6 − 6 − 1 = −1 and the double-bonded oxygen is 6 − 4 − 2 = 0, and together they add up to the ion’s charge, −1.

How do you know which atom is the central atom?

It is usually the least electronegative atom, and never hydrogen. Where that is unclear, compare the arrangements: nitrous oxide is N−N−O, with formal charges totalling 2, not N−O−N, which needs 4. Dichlorine monoxide is Cl−O−Cl, the only arrangement that gives every atom an octet and no formal charge, even though chlorine is the less electronegative of the two.

What are resonance structures?

Lewis structures with the same atoms in the same places and the electrons arranged differently. Nitrate has three equivalent ones, so the real ion is their average: every N−O bond has an order of 4/3 and every oxygen carries −2/3. Ozone has two, with a bond order of 3/2.

Should sulfate be drawn with double bonds?

It depends on the convention your course uses. Smallest formal charges gives two S=O bonds, sulfur at 0 and six resonance forms; octets first gives four single bonds, with sulfur at +2 and each oxygen at −1. Quantum chemical studies, such as Reed and Weinhold’s of SF₆ in 1986, find that sulfur’s d orbitals take only a minor part in its bonding, which supports the polar single-bond picture, and the switch draws both.

Why does the Lewis structure of oxygen fail?

The best Lewis structure, O=O with two lone pairs on each atom, pairs all 12 valence electrons, yet liquid oxygen clings to a magnet because O₂ has two unpaired electrons. A molecular orbital diagram explains them: the last two electrons go one each into two π* orbitals of equal energy.

How do you draw Lewis structures of ionic compounds?

Move the metal’s outer electrons to the non-metal and put each ion in brackets with its charge. Sodium chloride is [Na]⁺ and [Cl]⁻ with eight dots on the chloride, magnesium oxide is Mg²⁺ and O²⁻, and in sodium sulfate the sulfate ion keeps its own covalent bonds, and its six resonance forms, inside its brackets.