How to Add the Double-Slit Experiment to Your Website
LK Forge · 4 min read · Updated September 2026
You can add a full double-slit experiment 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. Visitors send a wave through two slits and watch bright and dark fringes appear, then switch to Particles and fire photons one at a time — each lands as a single random dot, yet the same fringe pattern builds up from thousands of them. This guide covers the fastest way to embed the tool, what it teaches, 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/double-slit-experiment/"
width="100%" height="1020" loading="lazy"
style="border:0;max-width:560px"
title="Double-Slit Experiment by LK Forge"></iframe>
<p><a href="https://lkforge.com/tools/physics/double-slit-experiment/">Double-Slit Experiment</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 simulator opens already firing particles, so a visitor watches the fringes build up immediately and can then take control:
- Wave or particles: see the continuous interference pattern, or fire photons one at a time and watch the same fringes emerge dot by dot.
- One slit or two: close a slit to make the interference collapse into a single diffraction blob, then reopen it and watch the fringes return.
- Slit separation, slit width, wavelength, screen distance: sliders change the geometry live, spreading or tightening the fringes.
- Diffraction envelope: each slit's finite width shapes a
sinc²envelope that dims the outer fringes, so widening a slit narrows the envelope. - Live readout: the panel tracks the particle count, the fringe spacing
Δy = λL/dand the wavelength.
Pick the right height
The snippet uses height="1020", which fits the experiment canvas, the view and slit toggles, the buttons, the sliders and the readout without clipping even on a narrow phone, where they stack into one column. 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/double-slit-experiment/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 physics lesson or a blog post on interference, diffraction or wave–particle duality needs an experiment students can actually fire.
Grab the embed code from the LK Forge widget gallery — free, no sign-up.
Open the Double-Slit ExperimentFrequently asked questions
- Is embedding the double-slit experiment free?
- Yes. It is free to embed on any site, with no account, no API key and no usage limits. The whole simulation runs in your visitor’s own browser, so there is no server cost — we only ask that you keep the small "Double-Slit Experiment by LK Forge" credit line that comes with the embed code.
- What can visitors do with the embedded simulator?
- They can switch between a continuous Wave view and a Particles view, choose one slit or two, press Fire, and reset. Sliders set the slit separation, slit width, wavelength, screen distance and fire rate, and a readout tracks the particle count, the fringe spacing Δy and the wavelength.
- Does the embed demonstrate wave–particle duality?
- Yes — that is the point. In Wave view it draws the Fraunhofer interference pattern directly; in Particles view each photon lands at a single random point drawn from that intensity curve, so the fringes emerge statistically from thousands of dots that never met. Close one slit and the interference collapses into a single diffraction blob.
- What iframe height should I use, especially on mobile?
- The snippet ships with height="1020", which is tall enough that the experiment canvas, the wave/particles and 1-slit/2-slit toggles, the fire and reset buttons, the sliders and the readout all fit without clipping even on a narrow phone, where the controls stack into a single column. On a wider page the widget simply centres within its max-width of 560px, so one height works across screen sizes.
- Where can I embed it — WordPress, Wix, Squarespace, Notion?
- Anywhere you can add HTML, because it is a standard iframe. In WordPress use a Custom HTML block; in Squarespace a Code/Embed block; in Wix an Embed HTML element; in Ghost an HTML card; in Notion paste the /embed/double-slit-experiment/ URL as an embed. On a plain HTML page or an intranet, paste the snippet straight into the markup.