How to Add a Logic Gate Simulator to Your Website
LK Forge · 4 min read · Updated September 2026
You can add a full logic gate simulator 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 flip binary inputs through the seven basic gates and read the truth tables live. This guide covers the fastest way to embed the Logic Gate Simulator, 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/logic-gate-simulator/"
width="100%" height="760" loading="lazy"
style="border:0;max-width:560px"
title="Logic Gate Simulator by LK Forge"></iframe>
<p><a href="https://lkforge.com/tools/physics/logic-gate-simulator/">Logic Gate Simulator</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 on an AND gate, so a visitor sees a working gate immediately and can then explore:
- Seven gates: AND, OR, NOT, NAND, NOR, XOR, XNOR — each with the correct symbol and bubble.
- Toggle the inputs: flip A and B between 0 and 1 and watch the wires light for logic 1.
- Output LED: lights when the gate outputs 1, so the rule is visible at a glance.
- Live truth table: the row for your current inputs is highlighted beside the gate.
Pick the right height
The snippet uses height="760", which fits the gate, the buttons, the input toggles and the readouts 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/logic-gate-simulator/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 logic gates, truth tables, Boolean algebra or digital electronics needs gates students can actually toggle.
Grab the embed code from the LK Forge widget gallery — free, no sign-up.
Open the Logic Gate SimulatorFrequently asked questions
- Is embedding the logic gate simulator 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 "Logic Gate Simulator by LK Forge" credit line that comes with the embed code.
- What can visitors do with the embedded simulator?
- They choose one of seven gates — AND, OR, NOT, NAND, NOR, XOR or XNOR — and toggle the binary inputs A and B. The gate symbol lights its input and output wires for logic 1, an output LED shows the result, and the gate's truth table sits alongside with the current input row highlighted.
- Does the embed show truth tables?
- Yes. Every gate is drawn next to its full truth table — four rows for a two-input gate, two for NOT — and the row matching the inputs you have set is highlighted live. It is a fast way for students to connect a gate's symbol, its behaviour and its truth table in one view.
- What iframe height should I use, especially on mobile?
- The snippet ships with height="760", which is tall enough that the gate diagram, the gate buttons, the input toggles and the readouts all fit without clipping even on a narrow phone where everything stacks into a single column. On a wider page the widget simply centres within its max-width of 560px. If you want it shorter you can lower the height, but 760 is the safe default 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/logic-gate-simulator/ URL as an embed. On a plain HTML page or an intranet, paste the snippet straight into the markup.
- Does the embedded simulator track visitors or set cookies?
- No. Everything runs locally in the visitor’s browser — nothing is uploaded. The embed sets no tracking cookies and sends no analytics, so it is safe to place on a privacy-sensitive site, an intranet, or a page for students.