Hubble's Law & Redshift Lab
Watch a galaxy's spectral lines redshift with distance, plot a Hubble diagram, and measure the expansion rate of the universe for yourself.
How to use: add galaxies at different distances, watch their spectral lines redshift, and see the points build a Hubble diagram whose slope is the Hubble constant.
Challenge 1: read a redshift
Set the current galaxy's distance so its recession velocity is close to 7000 km/s (within 5%), using your chosen H₀.
Challenge 2: measure H₀ from the data
Add at least 4 galaxies at different distances, then set your H₀ slider to match the true slope of your plotted points (within 10%).
About the Hubble's Law & Redshift Lab
Free hubble's law & redshift lab. Watch a galaxy's spectral lines redshift with distance, plot a Hubble diagram, and measure the expansion rate of the universe for yourself. Drag, change the sliders and see the result live. No sign-up, works on phone and computer. Built for astronomy, the hubble's law & redshift lab runs instantly in your browser: change a setting or drag an object and the result updates at once, so you learn by trying things out rather than only reading about them.
Watch a galaxy's spectral lines redshift with distance, plot a Hubble diagram, and measure the expansion rate of the universe for yourself. Use it to explore astronomy ideas at your own pace, then check what you found against the key ideas further down this page.
How to use the Hubble's Law & Redshift Lab
- Use the controls to change Galaxy distance (Mpc), Your H₀ estimate (km/s/Mpc). The simulation reacts instantly.
- Press "➕ Add this galaxy to plot", "Clear plot", "🎲 Add 5 random galaxies", "Reset to defaults" to start, reset or change what is happening.
- Where you see a glowing handle, object, weight or atom, drag it with your mouse or finger. Everything responds in real time.
- Watch the readouts and graphs update as you experiment, and compare what you see with the key ideas below.
Things to try
- Add five galaxies at very different distances and watch the Hubble diagram form a line.
- Drag your H₀ slider until it lines up with your own plotted points.
- Push one galaxy far out and watch the spectral line shift much further toward red.
- Try to land the recession velocity exactly on 7000 km/s.
Key ideas you can learn
- Redshift is measured from a spectral line's shift: z = (observed wavelength minus rest wavelength) divided by rest wavelength.
- For distant galaxies, recession velocity follows v ≈ z × c (the low-redshift Doppler approximation).
- Hubble's law says v = H₀ × d: the farther a galaxy, the faster it appears to recede, because space itself is expanding between us and it.
- Plotting velocity against distance for many galaxies gives a straight line whose slope is the Hubble constant, H₀ - this is literally how Hubble first measured the universe's expansion rate.
Where this is used in the real world
Astronomers use Hubble's law and redshift surveys of thousands of galaxies to map the large-scale structure of the universe and to estimate its age from the inverse of the Hubble constant.
Who is this simulation for?
Students, teachers and curious learners of all ages.
For teachers: project it on the board, let students predict what will happen, then run it together. For students: change one thing at a time and write down what changes.
Frequently asked questions
Why does a bigger redshift mean a more distant galaxy?
Hubble's law, v = H0 d, means recession velocity grows with distance; since redshift z is essentially a measure of that recession velocity, a larger z corresponds to a larger v and therefore a larger d.
Why do real astronomers get slightly different values for H₀ depending on their method?
Different techniques (nearby supernova distance ladders versus the cosmic microwave background) measure the expansion rate through different physics and different eras of the universe, and their results disagree by a few percent - an unresolved discrepancy called the Hubble tension.
Is the Hubble's Law & Redshift Lab free to use?
Yes. It is completely free, with no signup, no download and no ads inside the simulation. It runs in your web browser.
Does the Hubble's Law & Redshift Lab work on a phone or tablet?
Yes. It uses touch as well as the mouse, so you can drag objects with your finger. A larger screen makes the controls easier to see.