Lewis Structure Generator (with VSEPR Shape)
Lewis structures with formal charges and resonance, plus VSEPR shape and polarity.
Lewis structure
VSEPR shape
Formal charges
Formal charge = valence electrons − lone-pair electrons − bonds (½ × bonding electrons).
How it was worked out
About the Lewis Structure Generator (with VSEPR Shape)
Type a formula — CO2, NH4+, SO4^2-, XeF4, NO3- — or a name such as water or sulfate, and get its Lewis structure drawn with bonds, lone pairs and formal charges. The calculator counts the valence electrons, tries every arrangement of single, double and triple bonds around the central atom and keeps the ones that satisfy the octet rule (with expanded octets from period 3 and the incomplete octets of boron and beryllium) and minimise the formal charges. When several structures are equally good it shows all the resonance forms and the average bond order.
With the structure come its VSEPR description — AXₙEₘ class, electron-pair geometry, molecular shape, ideal bond angles and hybridisation — and whether the molecule is polar. For species such as sulfate, where textbooks disagree between the formal-charge structure (two S=O) and the octet structure (four S–O single bonds), both are shown. Drawings can be downloaded as SVG or PNG. Molecules that need more than one central atom (C₂H₆, H₂O₂, oxoacids) get a clear explanation instead of a wrong picture.
How to use it
- Type a formula (CO2, NH4+, SO4^2-, XeOF4) or a name (water, ammonia, nitrate). Charges can be written NH4+, SO4^2-, SO4 2- or SO4(2-).
- Read the Lewis structure: dots are lone pairs, lines are bonds, and small labels are formal charges. Use the arrows to step through resonance forms.
- If the central atom has an expanded octet, switch between Lowest formal charges and Octet rule to see both conventions.
- Check the VSEPR shape, angles, hybridisation and polarity, and download the drawing as SVG or PNG.
Examples
CO2
O=C=O, 16 valence electrons, all formal charges 0; AX₂ linear, 180°, sp, nonpolar
H2O
two O–H bonds, two lone pairs on O; AX₂E₂ bent (104.5° measured), polar
NH4+
formal charge +1 on N; AX₄ tetrahedral, 109.5°
NO3-
three resonance forms, N–O bond order 1⅓; AX₃ trigonal planar
SO4^2-
formal-charge structure with two S=O (six resonance forms) or the octet structure with four S–O and S +2; AX₄ tetrahedral
XeF4
36 valence electrons, two lone pairs on Xe; AX₄E₂ square planar, nonpolar
SF4
one lone pair on S (equatorial); AX₄E seesaw, polar
NO2
17 valence electrons: one unpaired electron on N; bent
Common uses
- Chemistry homework on Lewis structures, formal charge, resonance and VSEPR, with every count shown.
- Checking a hand-drawn structure: are the electrons counted right, and is the formal charge distribution the best one?
- Seeing why expanded and incomplete octets happen, and how textbooks differ on species such as sulfate and phosphate.
- Making clean diagrams of molecules and ions for notes, worksheets and slides.
How the structure is found
The steps follow OpenStax Chemistry 2e §7.3:
- Count the valence electrons of all atoms; add one for each negative charge, subtract one for each positive charge (SO₄²⁻: 6 + 4 × 6 + 2 = 32).
- Choose the central atom — usually the least electronegative, never hydrogen — and bond every other atom to it.
- Complete the octets of the outer atoms (a duet for hydrogen), then put any electrons left over on the central atom.
- Make multiple bonds if the central atom lacks an octet, by sharing lone pairs of the outer atoms.
The calculator does this for every possible combination of bonds and every possible central atom, then ranks the results by formal charge.
Formal charge and the best structure
Formal charge = valence electrons − lone-pair electrons − ½ × bonding electrons. It is bookkeeping, not a real charge, and the formal charges always add up to the charge of the species. Following OpenStax §7.4, the preferred structure has formal charges of zero where possible, otherwise the smallest ones, no like charges on neighbouring atoms, and negative charges on the more electronegative atoms. That is how N₂O comes out as N≡N–O rather than N=N=O, and why carbon is the central atom in SCN⁻.
Expanded octets and the sulfate question
Atoms from period 3 on (P, S, Cl, Xe …) can have more than eight electrons around them, as in PCl₅ (10), SF₆ (12) and XeF₄ (12). Minimising formal charge then gives sulfate two S=O double bonds and a formal charge of 0 on sulfur — the structure many textbooks, including OpenStax, draw. The octet structure, with four S–O single bonds and +2 on sulfur, is also widely used: quantum-chemical studies find that sulfur’s d orbitals take little part in the bonding (for example E. Magnusson, J. Am. Chem. Soc. 112 (1990) 7940), so many chemists regard the S–O bonds as polar single bonds. Both describe the same tetrahedral ion; the calculator shows both so you can use your course’s convention.
VSEPR shapes
Electron domains around the central atom — each lone pair and each bond, single or multiple — repel each other and spread out as far as possible (Gillespie and Hargittai, The VSEPR Model of Molecular Geometry, OpenStax §7.6). Two to seven domains give the linear, trigonal planar, tetrahedral, trigonal bipyramidal, octahedral and pentagonal bipyramidal electron-pair geometries; the molecular shape describes only the atoms. Lone pairs take more room than bonds, so they squeeze the bond angles (H₂O: 104.5° instead of 109.5°), sit in the equatorial positions of a trigonal bipyramid (SF₄ seesaw, ClF₃ T-shaped, XeF₂ linear) and opposite each other in an octahedron (XeF₄ square planar).
Polarity
A bond is polar when the two atoms differ in electronegativity; a molecule is polar when its bond dipoles (and lone pairs) do not cancel. Symmetric shapes with identical outer atoms — linear CO₂, trigonal planar BF₃, tetrahedral CCl₄, square planar XeF₄ — are nonpolar even though their bonds are polar; bent H₂O, pyramidal NH₃ and seesaw SF₄ are polar. The table of bond dipoles uses Pauling electronegativities.
Sources
- OpenStax, Chemistry 2e: §7.3 Lewis Symbols and Structures, §7.4 Formal Charges and Resonance and §7.6 Molecular Structure and Polarity.
- R. J. Gillespie and I. Hargittai, The VSEPR Model of Molecular Geometry (Allyn and Bacon, 1991).
- E. Magnusson, “Hypercoordinate molecules of second-row elements: d functions or d orbitals?”, J. Am. Chem. Soc. 112 (1990) 7940–7951.
- IUPAC Compendium of Chemical Terminology (Gold Book): “Lewis formula”, “formal charge”.
- Pauling electronegativities: PubChem periodic table (NCBI).
Limitations
- Only species built around one central atom are drawn: molecules with chains (C₂H₆, H₂O₂, N₂H₄) or with hydrogen on oxygen (oxoacids, alcohols) need more than one central atom.
- Transition-metal compounds and ionic compounds are outside the Lewis model used here; ions can be drawn one at a time (Cl-, NH4+).
- Lewis structures cannot show everything: O₂ comes out with all electrons paired although it is paramagnetic, and resonance is shown as separate forms of what is really one averaged structure.
- Bond angles are VSEPR’s ideal values with the direction of any distortion; measured angles are quoted only for a few molecules (H₂O, NH₃, CH₂O).
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.
Frequently asked questions
How do I draw a Lewis structure?
Count the valence electrons, put the least electronegative atom in the middle, join every other atom to it with a single bond, give the outer atoms full octets, put leftover electrons on the central atom, and form double or triple bonds if the central atom still lacks an octet. Then check the formal charges.
How is formal charge calculated?
Formal charge = valence electrons − lone-pair electrons − half the bonding electrons. For the N in NH₄⁺: 5 − 0 − ½ × 8 = +1. The formal charges of all atoms add up to the overall charge.
What are resonance structures?
Equally good Lewis structures that differ only in where the electrons are, such as the three structures of nitrate with the N=O bond on a different oxygen each time. The real ion is an average of them: all three N–O bonds are the same, with a bond order of 1⅓.
Why can sulfur and xenon have more than eight electrons?
Atoms from period 3 on are large enough to bond to more atoms, so species such as SF₆ and XeF₄ exist with 12 electrons around the central atom. Period 2 atoms (C, N, O, F) never exceed an octet.
What does AX₃E mean?
It is the VSEPR class: A is the central atom, X the bonded atoms and E the lone pairs on A. AX₃E (NH₃) has four electron domains — tetrahedral electron geometry — but only three atoms, so the molecule is trigonal pyramidal.
Is CO₂ polar?
No. Each C=O bond is polar, but the molecule is linear, so the two bond dipoles point in opposite directions and cancel. Water, which is bent, is polar.