Widgets

How to Add Conway's Game of Life to Your Website

LK Forge · 4 min read · Updated September 2026

You can add Conway's Game of Life to any website, blog, or classroom page with a single line of code — free, with no sign-up, no plugin, and no script to install. It is the most famous cellular automaton: click or drag to draw cells, drop in a glider gun or a pulsar, then press play and watch complex patterns grow from just four rules. This guide covers the fastest way to embed the tool, what it shows, and where it works.

The quickest way: paste one embed snippet

An embed is just an <iframe> that loads the simulator from lkforge.com, plus a small credit line. Copy this into your page’s HTML where you want the widget to appear:

<iframe src="https://lkforge.com/embed/game-of-life/"
        width="100%" height="700" loading="lazy"
        style="border:0;max-width:560px"
        title="Conway's Game of Life by LK Forge"></iframe>
<p><a href="https://lkforge.com/tools/physics/game-of-life/">Conway's Game of Life</a>
   by <a href="https://lkforge.com/">LK Forge</a></p>

The <iframe> is the live simulator; the <p> underneath is a plain credit link. Keep that line — the visible link is what keeps the widget free to embed. You can also copy this exact code straight from the LK Forge widget gallery.

What the widget shows

The grid opens ready to draw on, so a visitor can start a pattern immediately and then let the rules take over:

  • Draw and randomize: click or drag to paint live cells by hand, or hit Randomize to drop in a random soup and see what survives.
  • Built-in patterns: load a Glider, the Gosper glider gun, a pulsar, a lightweight spaceship or the R-pentomino from the pattern picker.
  • Play and step: run it at an adjustable speed, or use Step to advance one generation at a time and study still lifes, oscillators and spaceships.
  • Wrapping grid: the edges wrap around, so a glider that leaves one side reappears on the other and streams keep travelling.

Pick the right height

The snippet uses height="700", which fits the grid, the pattern picker and the play controls without clipping even on a narrow phone, where they stack into one column below the grid. On a wider page the widget centres within its max-width:560px. That single height works across screen sizes, so there is nothing to tweak for mobile.

Where it works

Because it is a standard iframe, the embed works anywhere you can add HTML:

  • WordPress: add a Custom HTML block and paste the snippet.
  • Squarespace: use a Code / Embed block.
  • Wix: add an Embed HTML / iframe element.
  • Ghost: insert an HTML card.
  • Notion: paste the /embed/game-of-life/ URL and choose "Create embed".
  • Plain HTML, an intranet, or a lesson page: paste the snippet straight into the markup.

That’s the whole job. Copy the embed code from the widget gallery and paste it wherever a lesson or a blog post on cellular automata, emergence or simple rules producing complex behaviour needs a grid students can actually draw on.

Grab the embed code from the LK Forge widget gallery — free, no sign-up.

Open Conway's Game of Life

Frequently asked questions

What can visitors do with the embedded Game of Life?
They can click or drag on the grid to draw their own live cells, hit Randomize for a random soup, or load a preset like the Glider, the Gosper glider gun, a pulsar, a lightweight spaceship or the R-pentomino. Then Play runs the simulation at an adjustable speed, Step advances one generation at a time, and Clear empties the grid.
What rules does the simulation follow?
The standard Conway rules, applied to every cell at once. A live cell with two or three live neighbours survives; a live cell with fewer than two dies from underpopulation, and one with more than three dies from overpopulation; a dead cell with exactly three live neighbours becomes alive. Those four rules produce all of the game’s complex behaviour.
Do the presets like the glider gun really work?
Yes. Load the Gosper glider gun and it fires a steady stream of gliders across the grid; the pulsar blinks as an oscillator; the lightweight spaceship crawls sideways. The grid wraps around at its edges, so a pattern that travels off one side reappears on the other, which lets spaceships and streams keep going.
What iframe height should I use, especially on mobile?
The snippet ships with height="700", which is tall enough that the grid, the pattern picker and the play controls all fit without clipping even on a narrow phone, where the controls stack into a single column below the grid. On a wider page the widget simply centres within its max-width of 560px, so the same height works across screen sizes.