Lewis Structure Generator
Generate a Lewis dot structure from any supported chemical formula and see valence electrons, bonds, lone pairs, and formal charges. This free Lewis structure generator doubles as a Lewis structure calculator: enter a molecule or ion, get the diagram and every step behind it.
How to Use the Lewis Structure Generator
Step 1
Enter a chemical formula
Type the formula of a molecule or polyatomic ion, such as H2O, CO2, NH3, BF3, or SO4^2-. Write a charge with a trailing sign (NO3-, NH4+) or a caret for multiple charges (CO3^2-, SO4^2-).
Step 2
Click Generate Lewis Structure
The generator counts the valence electrons, chooses the central atom, distributes lone pairs, and forms multiple bonds. Everything runs in your browser — nothing is uploaded.
Step 3
Review the structure
Read the Lewis dot diagram for bonds, lone pairs, and formal charges, then check the summary tables: central atom, bond counts, total valence electrons, and the octet check.
Step 4
Follow the steps
Every result ends with a numbered, step-by-step explanation, so you can see exactly why the structure looks the way it does — and redraw it by hand.
How to Draw a Lewis Structure Step by Step
The generator follows the same procedure you use on paper. Here is the full method, using CO2 as the running example.
1Count the valence electrons
Add the valence electrons of every atom, then add one electron per unit of negative charge or remove one per unit of positive charge. CO2 has 4 from carbon and 2 × 6 = 12 from oxygen, so 16 in total.
2Choose the central atom
The least electronegative atom — excluding hydrogen — usually goes in the middle. In CO2 that is carbon, so carbon is the central atom and the two oxygens are outer atoms.
3Connect the atoms
Draw a single bond from each outer atom to the central atom. Each bond holds two electrons, and hydrogen needs nothing more than its single bond.
4Complete the outer octets
Distribute the remaining electrons as lone pairs until every outer atom has eight electrons around it. Each oxygen in CO2 takes three lone pairs, using 12 electrons.
5Place leftovers on the central atom
Any electrons still unplaced become lone pairs on the central atom. Elements in period 3 and beyond can hold more than eight.
6Form multiple bonds
If the central atom is short of an octet, convert nearby lone pairs into shared bonding pairs. In CO2, one lone pair from each oxygen becomes a second bond, turning O—C—O into O=C=O.
7Check formal charges and octets
Assign a formal charge to every atom, prefer structures with the smallest charges, and flag exceptions such as electron-deficient boron or expanded octets on period-3 elements.
Popular Lewis Structure Examples
Click any formula to load it into the generator above. The list covers the structures chemistry courses ask for most often, from simple molecules like H2O and CH4 to resonance-stabilized ions like NO3−, CO3²−, and SO4²−.
Want geometry, polarity, and hybridization written out for a common molecule? Start here: CO2 Lewis Structure · SO2 Lewis Structure · H2O Lewis Structure · HCN Lewis Structure · NO2 Lewis Structure.
What Is a Lewis Structure?
A Lewis structure, also called a Lewis dot structure, is a diagram that shows how the valence electrons in a molecule or ion are arranged. Shared pairs of valence electrons are drawn as lines between atom symbols — one line per single bond, two for a double bond, three for a triple bond — while lone pairs appear as pairs of dots on the atom that keeps them.
Lewis structures are built around the octet rule: main-group atoms tend to be surrounded by eight electrons, either in bonds or as lone pairs, and hydrogen is satisfied with two. Counting valence electrons, placing them as bonds and lone pairs, and then checking formal charges tells you where charge sits in the molecule and which bonds are strongest. That makes the Lewis structure the starting point for predicting reactivity, resonance, and molecular geometry.
Lewis Structures for Molecules and Ions
The same drawing rules cover neutral molecules and charged ions. For a molecule, the valence electrons come only from the atoms. For an ion, the charge changes the count: a negative charge adds electrons and a positive charge removes them. Nitrate, NO3−, has 24 valence electrons — 5 from nitrogen, 18 from three oxygens, and 1 more for the charge.
Ions are drawn inside square brackets with the charge written outside as a superscript, which is exactly how the generator labels results for species like NH4+, CO3²−, and SO4²−. When a bond could sit on several equivalent positions, as in nitrate or carbonate, the generator also shows the equivalent resonance structures and treats the real ion as their hybrid.
Currently supported: neutral molecules and common polyatomic ions built around one central atom, including single, double, and triple bonds, lone pairs, formal charges, octet exceptions, and equivalent resonance forms. Radicals and multi-center skeletons are on the roadmap.
Frequently Asked Questions
Is this Lewis structure generator free?
Yes. The Lewis structure generator is completely free, runs entirely in your browser, and needs no account. You can generate as many structures as you like for molecules and ions.
Can the generator draw Lewis dot structures?
Yes. This Lewis dot structure generator draws every result as a complete dot diagram: atom symbols, single, double, and triple bonds, lone pairs drawn as dot pairs, formal charges on each atom, and square brackets with the overall charge for ions.
Can I calculate Lewis structures for ions?
Yes. Enter polyatomic ions such as NO3-, NH4+, CO3^2-, or SO4^2-. The generator adds or removes electrons for the charge before distributing them, shows the equivalent resonance forms where they exist, and labels the ion with brackets and its charge.
How do you calculate total valence electrons?
Add up the valence electrons of every atom in the formula, then add one electron per unit of negative charge or remove one per unit of positive charge. For example, CO3^2- has 4 from carbon, 3 × 6 = 18 from oxygen, and 2 more for the 2− charge, giving 24 valence electrons in total.
Does the calculator show formal charges and lone pairs?
Yes. Alongside the diagram, the Lewis dot structure calculator lists formal charges for every atom, the number of lone pairs, the central atom, the total valence electron count, an octet-rule check, and a step-by-step explanation of how the structure was built.
Related Chemistry Calculators
Keep working the problem with the other free tools on this site. Since you are already typing chemical formulas, the Molar Mass Calculator pairs naturally with this one.
- Chemical Equation BalancerBalance any reaction and see atom counts.
- Stoichiometry CalculatorConvert between moles, mass, and reaction amounts.
- Molar Mass CalculatorFind molar mass from any molecular formula.
- Limiting Reactant CalculatorIdentify the limiting reagent and theoretical yield.
- Empirical Formula CalculatorTurn percent composition into an empirical formula.