Build Your Crystal
See how atoms sit in a unit cell, or switch to Build and make your own crystal as a game
Show the working: density from the unit cell
User Guide — Build Your Crystal
1 Overview
Build Your Crystal shows how atoms and ions sit in a crystal and how the repeating unit cell turns into numbers: atoms per cell, coordination number, packing fraction and density. Pick any of the 24 crystals in the catalogue on the right (metals, covalent solids and ionic compounds) and switch between six views. There are five modes: Simulate (the default), Build (a game), Explore (18 concept cards), Practice (15 problem types) and Quiz (25 questions, 8 per sitting).
The topic is taught in first-year university general chemistry and introductory materials science. Every figure on the page is calculated from one lattice parameter per crystal, so changing the crystal changes every number together.
2 The six views
- Unit cell: the cell with its atoms in place. Drag to rotate (mouse or touch), use the arrow keys when the canvas is focused, double-click or press Home to reset. Rotate toggles slow auto-rotation (R); True size draws atoms at their real radius instead of small markers (S). Cut to cell (C, in this view and Atom sharing) slices every atom off at the cell faces, the way a sectioned teaching model is made, so a corner atom shows as the eighth of a sphere that really lies inside and a face atom as a hemisphere. Covalent crystals (diamond, silicon, germanium) are drawn with their bonds. Count atoms (N) plays the whole count for you: it turns on true size, cuts the atoms to the cell while it turns, then flies the pieces out and joins them into whole atoms (eight corner eighths make one, two opposite face halves make one, four edge quarters make one) and drops each into a tally until it reaches the atoms per cell.
- Atom sharing: every atom wears a small pie showing the fraction of it that lies inside the cell (⅛ for a corner, ¼ for an edge, ½ for a face, 1 inside). Press Count next group to add them up one group at a time; Back and Show all move through the working. For FCC it reads 8 × ⅛ + 6 × ½ = 4.
- Touching: the atoms drawn at true size, with gold lines joining every touching pair. The bright line is the one the contact relation is read along (edge, face diagonal or body diagonal), with the right-triangle construction for BCC and FCC and the relation printed under the cell (for FCC: √2·a = 4r).
- 2×2×2 block: the cell repeated in all three directions (two stacked prisms for HCP), to see why shared atoms count only a fraction.
- Layers: close-packed layers lettered A, B, C. FCC stacks A B C A along the body diagonal; HCP stacks A B A. The button is disabled for structures that are not close-packed.
- Holes: octahedral (gold) and tetrahedral (cyan) holes of the FCC frame, with one of each outlined. Choose Both, Octahedral or Tetrahedral. In NaCl, ZnS, CaF₂ and Li₂O the filled holes are the second ion. Available for the FCC-based structures only.
3 Build mode (the game)
Switch to Build to make a crystal yourself. A crystal is a lattice plus a basis: choose the lattice, then place the basis, the atoms attached to every lattice point.
- Lattice: P (primitive) repeats each atom once per cell, I (body-centered) adds a copy at the center, F (face-centered) adds copies in the three face-center positions. A site already filled by the lattice shows a lighter dashed ring and cannot take a second atom.
- Particles: choose up to three kinds (metal atoms or ions) with their real sizes. Press a number, then place.
- Place atoms: click a dot to place an atom, click an atom to remove it, drag to rotate. The cell has 16 distinct positions (corners, edges, faces, the body center and eight tetrahedral holes); an atom on a corner appears on all eight corners because the cell repeats. Without a mouse, open Place atoms from a list.
- Cell size: by default the atoms just touch, which is what makes the packing fraction meaningful. Untick it to set the edge length yourself; overlapping atoms are flagged in red.
- Live readouts give atoms per cell, formula, the lattice you really made, coordination number, packing fraction and density, and say which catalogue structure matches (for example “Rock salt (NaCl)”) wherever you put the origin.
- Levels: 12 challenges, from simple cubic to antifluorite, with three stars each (the fewest atoms placed earns three, a hint caps it at two). Your best stars are remembered in this browser. Sandbox has no goal, and Or start from a known structure loads any of the nine cubic structures to take apart.
Cubic cells only; hexagonal close-packed is in Simulate, Explore and Practice but cannot be built.
4 Reading the numbers
- Atoms per cell is the sum of the shared fractions of the atoms drawn. HCP uses the hexagonal prism (6 atoms), the way textbooks draw it.
- Coordination number is found by measuring distances in the lattice. Real HCP metals are not exactly 12 at one distance: magnesium, titanium and cobalt read 12 (6 + 6) because the second six are within 5%, and zinc reads 6 + 6 (distorted) because its c/a ratio (1.856) is far above the ideal 1.633.
- Packing fraction is (atoms per cell × volume of one atom) ÷ cell volume. For ionic crystals the ions are drawn at their Shannon radii.
- Density shows the calculated value beside the handbook value. Open Show the working to see Z, M, V and NA written out.
- Ionic crystals also show the radius ratio r⁺/r⁻ and what the radius-ratio rule predicts. It is a guide, not a law: Li₂O is the exception the tool keeps on purpose.
- Lengths are in ångström and picometres throughout. There is no SI/Imperial toggle because chemists and materials scientists use these units everywhere.
5 Explore, Practice and Quiz
- Explore has four tabs of concept cards. Each card ends with See it in the simulator, which opens the right crystal in the right view.
- Practice asks calculation problems: counting atoms, edge length from radius, packing fraction, density of metals and ionic compounds, edge length and atomic radius from a measured density, coordination number, holes, the radius-ratio rule and the hexagonal cell volume. Type a number and press Enter; a worked solution appears after you answer. Answers are marked from the numbers printed in the problem, with NA = 6.022×10²³ mol⁻¹.
- Quiz draws 8 of 25 questions in a random order with the options shuffled each time. Every answer comes with an explanation.
6 Accuracy and limits
- Lattice parameters are room-temperature handbook values, and the calculated density is checked against the handbook density for every crystal (within about 1%).
- Atoms are treated as touching hard spheres. Real atoms are soft, so a packing fraction is a model, not a measurement.
- Ion sizes are Shannon effective radii for the coordination found in each structure. The sum of the radii can differ from the real contact distance by a few per cent (ZnS about 4%), which the tool reports rather than hides.
- Not included: Miller indices and planes, X-ray diffraction, and point defects. Build mode is cubic only.
Crystal Structure Simulation and Animation: Free Online Unit Cell Simulator — Build SC, BCC, FCC, HCP and Ionic Crystals
Build Your Crystal is a free crystal lattice simulator and virtual lab for the lattice structures of crystalline solids. It runs in the browser with nothing to install and no sign-up, and it has two ways in. In Simulate, choose a metal, a covalent solid or an ionic compound, rotate its unit cell in 3D and watch the cell share its atoms with its neighbors. In Build, a crystal-building game, you choose a lattice and place the atoms yourself. Either way the unit cell turns into the numbers a general chemistry or materials science course asks for: atoms per cell, coordination number, packing efficiency and density.
What Is a Unit Cell?
A crystal is a regular, repeating arrangement of atoms. The unit cell is the smallest block that, stacked in all three directions with no gaps, rebuilds the whole crystal. The size of a cubic cell is its lattice parameter (edge length) a. A lattice is the abstract array of repeat points and the basis is the atom or group of atoms attached to each point: rock salt is an FCC lattice with a two-ion basis, and diamond is an FCC lattice with a two-atom basis.
How Many Atoms Are in a Unit Cell?
Atoms on the corners, edges and faces are shared with neighboring cells, so each counts only a fraction: ⅛ for a corner, ¼ for an edge, ½ for a face, 1 for an atom wholly inside. The Atom sharing view adds them up group by group. The coordination number is the number of nearest neighbors an atom touches. (Body-centered and face-centered are also spelled body-centred and face-centred.)
| Structure | Atoms per cell | Coordination number | Packing efficiency | Edge length a and radius r | Examples |
|---|---|---|---|---|---|
| Simple cubic (SC) | 1 | 6 | 52.4% | a = 2r | Polonium |
| Body-centered cubic (BCC) | 2 | 8 | 68.0% | a = 4r/√3 | α-Fe, Cr, W, Na |
| Face-centered cubic (FCC) | 4 | 12 | 74.0% | a = 2√2·r | Cu, Al, Ag, Au, Ni, Pb |
| Hexagonal close-packed (HCP), Mg | 6 | 12 (6 + 6) | 73.6% | a ≈ 2r | Mg, Ti, Co |
| Hexagonal close-packed (HCP), Zn | 6 | 6 + 6 (distorted) | 65.1% | a = 2r | Zn |
| Diamond cubic | 8 | 4 | 34.0% | a = 8r/√3 | C, Si, Ge |
Crystal Structure Animation: Watch a Unit Cell Being Cut and Counted
Most crystal structure animations online are old Java, Shockwave or Jmol pages that show a cell turning and stop there. This crystal structure simulation runs in any browser with nothing to install, and its animation follows the count itself. Pick any of the 24 crystals and press Count atoms: the cell first turns at true size so you can see the atoms touching, then the cell faces cut through them and the parts that belong to the neighboring cells drift away. The trimmed pieces then leave the cell through their own faces and join into whole atoms in a tray below, each group labeled with where it came from (corners, edges, faces or inside the cell) and its share, while the sum builds up beneath it. The ions in the tray are drawn to scale, so the small Li+ and the large O2− of lithium oxide look as different as they are, and each whole sphere still counts once. Drag to turn the cell at any point, or switch to the 2×2×2 block to see how one unit cell repeats into the crystalline structure of the whole solid.
How Do You Count the Atoms in a Unit Cell? (Cut-Away Model)
A drawing of an FCC cell shows 14 atoms, yet only 4 belong to it, and that gap is where most mistakes start. Press Cut to cell and every atom is sliced off at the cell faces, the way a sectioned teaching model is made: a corner atom shows as the eighth of a sphere that really lies inside, a face atom as a hemisphere, an edge atom as a quarter. Press Count atoms and the simulator plays the whole count as an animation: the atoms appear at true size, the parts outside the cell are cut away, and the pieces fly out of the cell and join into whole atoms in a row beneath it, eight corner eighths into one atom and two opposite face halves into another, until the total reads Z = 1 + 3 = 4 for face-centered cubic. It works the same way for body-centered cubic (8 × ⅛ + 1 = 2), rock salt (8 × ⅛ + 12 × ¼ + 6 × ½ + 1 = 8 ions, 4 formula units), fluorite and the hexagonal prism (12 × ⅙ + 2 × ½ + 3 = 6).
What Is the Difference Between a Lattice and a Basis?
Every crystal structure is a lattice plus a basis. The lattice is the repeating framework (simple cubic P, body-centered I or face-centered F); the basis is the atom or group of atoms attached to each lattice point. The same face-centered lattice gives very different crystals depending on the basis, and the Build game lets you try each one.
| Crystal | Lattice | Basis (atoms per lattice point) | Atoms per cell |
|---|---|---|---|
| Simple cubic (polonium) | P | 1 | 1 |
| Body-centered cubic (α-iron) | I | 1 | 2 |
| Face-centered cubic (copper) | F | 1 | 4 |
| Diamond cubic (C, Si, Ge) | F | 2 | 8 |
| Rock salt (NaCl) | F | 2 | 8 |
| Zinc blende (ZnS) | F | 2 | 8 |
| Cesium chloride (CsCl) | P | 2 | 2 |
| Fluorite (CaF₂) | F | 3 | 12 |
| Antifluorite (Li₂O) | F | 3 | 12 |
Cesium chloride shows why the lattice matters: its atoms sit at the corners and the center like BCC, but the two sites hold different ions, so the pattern repeats only by simple-cubic translations: lattice P with a two-ion basis. Fluorite and antifluorite are the same geometry with the roles swapped; only the charge of the ion on the close-packed frame (cation or anion) tells them apart.
How Does the Crystal-Building Game Work?
In Build mode you choose a lattice, pick up to three kinds of particle (metal atoms or ions with their real sizes) and place atoms on the 16 positions of a cubic unit cell: the corners, edges, face centers, body center and eight tetrahedral holes. Because the cell repeats, an atom on a corner appears on all eight corners. The game recognizes what you built wherever you put the origin, and reports atoms per cell, formula, coordination number, packing fraction and density. There are 12 levels, from simple cubic to antifluorite, each worth three stars: the fewest atoms placed earns all three, and a hint caps it at two. A sandbox lets you build freely, and you can start from any of the nine cubic structures and take it apart.
How Do You Find the Packing Efficiency of a Unit Cell?
Packing efficiency (atomic packing factor, APF) is the fraction of the cell volume filled by atoms treated as touching hard spheres: (atoms per cell × volume of one atom) ÷ cell volume. For FCC the atoms touch along the face diagonal, so √2·a = 4r and a = 2√2·r. Then APF = 4 × (4/3)πr³ ÷ (2√2·r)³ = π√2/6 = 0.7405. The result does not depend on the size of the atom, only on the arrangement. In BCC the atoms touch along the body diagonal (√3·a = 4r), which gives 68.0%; in simple cubic they touch along the edge, which gives 52.4%.
How Do You Calculate Density from the Unit Cell?
The mass of one cell is Z atoms of molar mass M, divided by Avogadro's number, and its volume is a³ for a cube: ρ = Z·M ÷ (V·NA). Run it backwards and a measured density tells you Z, and so which structure a metal has. The simulator calculates it from the lattice parameter and checks it against the handbook.
| Crystal | Structure | Edge length a (pm) | Calculated density (g/cm³) | Handbook density (g/cm³) |
|---|---|---|---|---|
| Copper | FCC | 361.5 | 8.94 | 8.96 |
| Aluminum | FCC | 405.0 | 2.70 | 2.70 |
| α-Iron | BCC | 286.7 | 7.87 | 7.87 |
| Tungsten | BCC | 316.5 | 19.25 | 19.25 |
| Magnesium | HCP | 320.9 | 1.74 | 1.74 |
| Silicon | Diamond cubic | 543.1 | 2.33 | 2.33 |
| Sodium chloride | Rock salt | 564.0 | 2.16 | 2.17 |
Worked example, copper: Z = 4, M = 63.55 g/mol, a = 361.5 pm = 3.615×10⁻⁸ cm, so V = 4.724×10⁻²³ cm³ and ρ = 4 × 63.55 ÷ (4.724×10⁻²³ × 6.022×10²³) = 8.94 g/cm³.
What Is the Difference Between Cubic Closest Packing (FCC) and Hexagonal Closest Packing (HCP)?
Spheres packed in a flat layer touch six neighbors. A second layer sits in the dips of the first. The third layer then has a choice: directly over the first (A B A B…, hexagonal close-packed) or over the other set of dips (A B C A B C…, cubic close-packed, which is FCC viewed along its body diagonal). Both have coordination number 12 and the same ideal packing of 74.05%. General chemistry textbooks call these hexagonal closest packing (hcp) and cubic closest packing (ccp); cubic closest packing is the same structure as face-centered cubic, seen along a different direction. The Layers view shows the lettering on the real cell.
Why Is a Real HCP Metal Not Exactly 12-Coordinate?
Ideal close packing needs a c/a ratio of √(8/3) = 1.633. Magnesium (1.624), titanium (1.588) and cobalt (1.623) are close, so the six in-plane and six interlayer neighbors lie within 5% and the coordination number is quoted as 12. Zinc has c/a = 1.856: its six in-plane neighbors are at 266.5 pm but the next six are 9.3% farther away, so it is better described as 6 + 6 and its packing efficiency falls to 65.1%.
What Are Tetrahedral and Octahedral Holes?
Between the atoms of a close-packed lattice are two kinds of hole. An octahedral hole has 6 neighbors and fits a sphere of radius 0.414r; a tetrahedral hole has 4 neighbors and fits 0.225r. There is 1 octahedral and 2 tetrahedral hole per atom, so an FCC cell with 4 atoms has 4 octahedral and 8 tetrahedral holes. This is how ionic crystals are built: a close-packed frame of the larger ions with the smaller ions in some of the holes.
What Are the Common Ionic Crystal Structures?
The radius-ratio rule predicts the coordination of the small ion: 4 neighbors when r⁺/r⁻ is 0.225 to 0.414, 6 from 0.414 to 0.732, and 8 above 0.732. It works for the first four rows and fails for Li₂O, where the rule predicts 6 and lithium is 4-coordinate.
| Structure | Formula units per cell | Coordination (cation : anion) | r⁺/r⁻ | Holes filled |
|---|---|---|---|---|
| Rock salt (NaCl) | 4 | 6 : 6 | 0.564 | All octahedral holes of an FCC Cl⁻ frame |
| Cesium chloride (CsCl) | 1 | 8 : 8 | 0.961 | Cs⁺ at the body center of a simple cubic Cl⁻ lattice |
| Zinc blende (ZnS) | 4 | 4 : 4 | 0.326 | Half of the tetrahedral holes of an FCC S²⁻ frame |
| Fluorite (CaF₂) | 4 | 8 : 4 | 0.855 | All tetrahedral holes of an FCC Ca²⁺ frame |
| Antifluorite (Li₂O) | 4 | 4 : 8 | 0.415 | All tetrahedral holes of an FCC O²⁻ frame |
CsCl looks like BCC but is not: the corner and center atoms are different ions, so the lattice is simple cubic with a two-ion basis.
What Is Polymorphism and Allotropy?
The same substance can crystallize in more than one structure. For an element this is allotropy (carbon as diamond or graphite); for any compound it is polymorphism. Iron is BCC (α, ferrite) at room temperature and FCC (γ, austenite) between 912 and 1394 °C. FCC packs more densely and its octahedral holes are larger (0.414r against 0.155r in BCC), which is why austenite dissolves far more carbon than ferrite, the basis of steel heat treatment.
Unit Cell Practice Problems: Edge Length, Atomic Radius and Density
Practice draws from 15 problem types, the kind set in the solids chapter of a general chemistry course: counting atoms per cell, finding the edge length from the atomic radius and back, packing efficiency, density from the edge length, the atomic radius from a measured density, which structure a metal has from its density, coordination numbers, holes and the radius-ratio rule. Each shows a worked solution after you answer. Each problem has an Open in simulator button that loads the crystal it is about. The quiz draws 8 of 25 questions with the answer options shuffled every time.
Who Uses This Crystal Structure Simulator?
First-year university chemistry students meet unit cells in the solids chapter of general chemistry, with SC, BCC, FCC, NaCl and CsCl. Materials science and engineering students use the same ideas for density computations, packing, close-packed structures and interstitial sites. Instructors use the Atom sharing and Touching views as a lecture demonstration and the Build game as a virtual lab or classroom activity when physical model kits are not available. Anyone curious can treat Build as a puzzle game: how many different crystals can you make from one lattice?
Frequently Asked Questions
How many atoms are in a face-centered cubic (FCC) unit cell?
An FCC unit cell contains 4 atoms. The 8 corner atoms are each shared by 8 cells (8 × 1/8 = 1) and the 6 face-center atoms are each shared by 2 cells (6 × 1/2 = 3), so 1 + 3 = 4. The same counting gives 1 atom for simple cubic, 2 for body-centered cubic and 6 for the hexagonal close-packed prism.
What is the packing efficiency of simple cubic, BCC and FCC?
Simple cubic fills 52.4% of the cell, body-centered cubic 68.0% and face-centered cubic 74.0% (π√2/6 = 0.7405). Hexagonal close-packed with the ideal c/a ratio of 1.633 packs just as tightly, 74.05%, the highest possible for equal spheres. Diamond cubic is open at 34.0%.
How do you calculate the density of a metal from its unit cell?
Use ρ = Z·M ÷ (V·N_A), where Z is the number of atoms per cell, M the molar mass in g/mol, V the cell volume in cm³ (a³ for a cube) and N_A = 6.022×10²³ per mol. For copper (FCC, a = 361.5 pm, M = 63.55 g/mol): Z = 4 and V = 4.724×10⁻²³ cm³, so ρ = 4 × 63.55 ÷ (4.724×10⁻²³ × 6.022×10²³) = 8.94 g/cm³, against a handbook value of 8.96 g/cm³.
How do you build a crystal structure from a lattice and a basis?
A crystal structure is a lattice plus a basis. Choose the lattice (simple cubic, body-centered or face-centered), then place the basis: the atoms attached to every lattice point. One atom on a face-centered lattice gives the FCC structure of copper; two identical atoms a quarter of the way along the body diagonal give diamond; two different ions give rock salt or zinc blende; three particles give fluorite.
How do you count the atoms in a unit cell?
Count each atom by the fraction of it that lies inside the cell: 1/8 for a corner, 1/4 for an edge, 1/2 for a face and 1 for an atom wholly inside, then add them up. For face-centered cubic that is 8 × 1/8 + 6 × 1/2 = 4 atoms; for body-centered cubic 8 × 1/8 + 1 = 2. The Count atoms button animates it: the atoms are cut off at the cell faces and the pieces join into whole atoms beneath the cell.
Is there a free crystal structure game?
Yes. Build mode in this simulator is a free game with 12 levels and a sandbox. You place atoms on the 16 positions of a cubic unit cell, choose the lattice, and the game recognizes the structure you made, from simple cubic to diamond, rock salt, zinc blende and fluorite. You earn up to three stars for using the fewest atoms.
Explore Related Simulators
Continue with the atoms behind the structures in Build Your Atom, see how ionic and metallic bonds form in Chemical Bonds, or follow the materials theme to how crystals deform in the Stress-Strain Simulator.
Updated