QiLing Tools

🔵Lewis Structure Generator - Formal Charges, Resonance and Electron-Dot Formulas

A Lewis structure shows valence electrons as bonds (lines for shared pairs) and dots (lone pairs). An electron-dot formula, the style used in many school textbooks, draws the shared pairs as dots too. This tool builds both with the textbook recipe. It counts valence electrons, adjusting for an ion's charge, and puts the least electronegative atom in the centre. It completes the octets of the terminal atoms first (H needs 2) and puts the leftover electrons on the central atom. If the centre is still short of 8, terminal lone pairs become double or triple bonds. Formal charges are FC = valence − non-bonding − bonds. The best structure is chosen by satisfying octets, then minimising the sum of |formal charges|, then placing negative charge on the more electronegative atoms. CO₂ (16 valence electrons) gives O=C=O with zero formal charges. NO₃⁻ (24 electrons) gives N +1 and two single-bonded O −1, with 3 equivalent resonance structures. SO₄²⁻ is shown both as the minimum-formal-charge expanded octet and as the strict octet structure with S +2. BF₃ leaves boron with 6 electrons, XeF₄ has 2 lone pairs on Xe (12 electrons), and NO, NO₂ and ClO₂ are odd-electron radicals. Ionic compounds such as NaCl, MgCl₂, Na₂O, CaF₂, NH₄Cl and Na₂O₂ are written as ions, with bracketed anions and charges and identical ions kept separate. Binary salts also get a formation diagram using × and · electrons.

Free · No sign-up · Runs in your browserLast updated:

Loading tool...

How to use Lewis Structure Generator

  1. 1Type a formula such as CO2, NO3-, SO4^2-, XeF4, NaCl or NH4Cl, or click an example
  2. 2Choose Lewis structure (lines for bonds) or electron-dot formula (all dots)
  3. 3Read the diagram, resonance structures, formal-charge table and drawing steps; ionic compounds also show the formation diagram

FAQ

What is the difference between a Lewis structure and an electron-dot formula?
Both show how valence electrons are arranged. A Lewis structure uses a line for each shared pair and dots for lone pairs. An electron-dot formula draws the shared pairs as dots as well, so water becomes H:O:H with two lone pairs on oxygen. Ionic compounds are always shown as separate ions, with simple cations written as ion symbols and anions bracketed with their charge.
How do you calculate formal charge?
Formal charge = valence electrons − non-bonding electrons − number of bonds (a double bond counts as 2). In NO₃⁻, nitrogen has 5 valence electrons, no lone electrons and 4 bonds, so its formal charge is +1. Each single-bonded oxygen has 6 − 6 − 1 = −1. The formal charges always add up to the overall charge. The best structure keeps them near zero, with negative charge on the most electronegative atoms, which is why CO is C≡O and cyanate is mainly N≡C–O⁻.
Which molecules break the octet rule?
There are three common exceptions. Electron-deficient molecules: boron in BF₃ has 6 electrons and beryllium in BeCl₂ has 4. Odd-electron molecules: NO (11 valence electrons), NO₂ (17) and ClO₂ (19) must leave one atom with 7 electrons, so they are radicals. Expanded octets: central atoms from period 3 onward can exceed 8, such as P in PCl₅ (10), S in SF₆ (12) and Xe in XeF₄ (12: 4 bonds plus 2 lone pairs). Period-2 atoms C, N, O and F never exceed 8.
Should sulfate be drawn with S=O double bonds or all single bonds?
Both appear in textbooks. Minimising formal charge gives two S=O double bonds and two S–O⁻ bonds, with 12 electrons around sulfur and 6 resonance forms. Modern calculations show sulfur's d orbitals barely take part in bonding, so many university texts prefer the octet structure. That structure has four S–O single bonds, S at +2 and each O at −1, and treats the bonds as strongly polar. The tool shows both so you can match your course.

Features

  • Switch between Lewis structures and all-dot electron-dot formulas
  • Total valence electrons, bonding pairs and lone pairs
  • Formal charge for every atom, circled on the diagram
  • Equivalent and minor resonance structures (NO₃⁻, CO₃²⁻, O₃, N₂O, SCN⁻)
  • Expanded octets (SF₆, PCl₅, XeF₄, I₃⁻) shown alongside strict-octet forms
  • Electron-deficient (BF₃, BeCl₂) and odd-electron radicals (NO, NO₂, ClO₂)
  • Ionic compounds and their formation from atoms (NaCl, MgCl₂, Na₂O, Na₂O₂, NH₄Cl)
  • Common two-centre molecules: H₂O₂, N₂H₄, C₂H₄, C₂H₂, ethanol, acetic acid