Skip to the content
2 layers21.6 × 8.3 mmTopAndBottomLayer, the printed circuit board in 3D

Convert KiCad PCB designs into CNC GCode for isolation-engraving traces on copper-clad board and drilling through-holes — entirely in the browser.

Size
21.6 × 8.3 mm
Copper layers
2
Thickness
1.6 mm
Parts
2
Nets
2
Pads
4
Tracks, vias
2, 0
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
27 Jul 2026
Updated
5 Nov 2026

Overview

TopAndBottomLayer is an open-source printed circuit board by grserwe, from the grserwe/KiCadToGCodeSvelte repository on GitHub. It is a 2-layer board of 21.6 × 8.3 mm with 2 parts on 2 nets, routed with 2 tracks and 0 vias.

README

README.md

KiCadToGCode (SvelteKit)

Live at kicadtogcode.com — free, no sign-up, and your design never leaves your browser.

Convert KiCad PCB designs into CNC GCode for isolation-engraving traces on copper-clad board and drilling through-holes — entirely in the browser. This app replaced the original Blazor version (grserwe/KiCadToGCode) on the same domain.

Features

  • Accepts a .kicad_pcb file (KiCad 4 through 10) or a zipped KiCad project
  • Isolation-routing GCode for top and bottom copper, tool-diameter/V-bit aware, multi-pass with stepover
  • Drill GCode grouped per drill size, plus registration holes for double-sided flip-over machining (bottom side mirrored about the vertical centerline)
  • Board cutout GCode: an end mill follows the Edge.Cuts outline (lines, arcs, circles, rectangles, polygons — chained into closed loops, with inner cutouts cut first) offset by the cutter radius, climb milling in depth passes, leaving holding tabs on the straight edges
  • All pad shapes: circle, oval, rect, roundrect (incl. chamfered), trapezoid, and custom polygon (e.g. hexagonal) pads; ground pads get thermal-relief gaps
  • SVG preview of both board sides: copper, engraving paths, drills, registration holes, zoom/pan
  • GCode viewer: replays each generated program the way a GRBL controller would, drawing cuts at the tool's real width, rapids, and plunges over the designed copper (mapped into machine coordinates), with a move-by-move step-through and checks for rapids with the tool down, inconsistent arcs, cutting with the spindle off, and missing feed rates or units
  • Configurable CNC settings (feeds, speeds, depths, origin, units), persisted in the browser
  • Clearance-aware minimum widths: thin traces and small pads are widened to your configured minimums (so copper doesn't peel during machining), capped automatically wherever copper on another net is too close — widening can never cause a short, and blocked spots are reported
  • Silkscreen SVG for laser marking: the top (and bottom) silkscreen drawings and text as a millimetre-sized SVG ready for LightBurn, with Print and Cut alignment targets on two drilled holes, plus the board outline and registration holes on their own colour/layer
  • All processing client-side in a Web Worker — your design never leaves your machine
  • Recoverable problems surface as warnings (oval slot holes, copper zones, curved traces, inner layers) instead of failures

How the toolpaths are made

  1. Parse — a character-level S-expression tokenizer reads the .kicad_pcb into a board model in board-local, Y-up millimeter coordinates. Legacy (module) and modern (footprint) dialects both supported.
  2. Offset — every track becomes two parallel lines at width/2 + tool radius; where tracks meet, the lines are mitered or joined by angular adjacency. A track that runs through a pad (a component lead sitting mid-track) is first split at that pad so both pieces end inside it.
  3. Pad isolation — circular pads become arcs with gaps where tracks enter; other shapes build an outline (lines + corner arcs, inflated exactly by the tool radius) and gaps are cut out as perimeter intervals.
  4. Emit — a greedy nearest-neighbour walk orders the segments, then the transform pipeline applies side mirroring, user flips, XY-zero placement, and unit conversion before writing GRBL-safe GCode (G0/G1/G2/G3, M3/M5).

Board cutout

The profile program (<board>-profile.txt) cuts the board free, so it runs last. The Edge.Cuts drawings are chained end to end into closed loops (endpoints within 0.05 mm join; circles and polygons are loops already), the largest loop is the board boundary and loops inside it are holes. Every loop is wound so the material is on its left — boundary counter-clockwise, holes clockwise — and then offset to its right by the cutter radius: straight edges shift, outward arcs grow, inward arcs shrink, convex corners get an arc around the vertex and concave corners are trimmed to the intersection. Holes are cut before the boundary. With the bottom side mirrored, the loop direction is reversed so the machine still climb mills.

The cut is made in depth passes (total depth ÷ depth per pass, in output units). On the passes below the tab top, the cutter lifts to the tab height over each tab, which are spread evenly along the straight edges and kept clear of the corners. A board with no closed outline is cut along the rectangle of its extents, with a warning; an inside curve tighter than the cutter is reported and cut as a cusp.

Silkscreen for the laser

The silkscreen output is an SVG, not GCode: LightBurn imports SVG and plans the laser job itself. The parser keeps every fp_*/gr_* drawing on F.SilkS, B.SilkS and Edge.Cuts (lines, arcs, circles, rectangles, polygons, in both the modern three-point and the KiCad 4/5 centre-and-angle arc dialects), placed with the same footprint transform the pads use. The SVG uses LightBurn's first three palette colours so each kind of geometry arrives on its own layer:

  • black — silk lines as centreline vectors (a diode laser's spot is about a silk line's width, so a single pass draws them at the right size)
  • blue — filled silk shapes, to be cut in Fill mode
  • red — the board outline and the registration holes, for aligning the burn to the milled board; set that layer's output off before burning

The bottom side is mirrored left-over-right (the face the laser sees), the same convention as the bottom isolation GCode. Silkscreen text (reference designators, labels) is parsed but not drawn yet — KiCad draws text with its own stroke font, which the engine doesn't carry — and a warning lists how many items were left out.

Roadmap (not yet supported)

  • Copper zones / filled pours
  • Curved (arc) traces
  • Inner layers (4+ layer boards)

Development

bash
npm install
npm run dev        # dev server
npm run test       # vitest unit tests
npm run check      # svelte-check / type-check
npm run lint       # prettier + eslint
npm run build      # production build (adapter-node)

Feedback form

"Send feedback" in the footer (and "Report a problem" next to the output) opens a dialog that emails the message to the developer. The user's PCB file is attached by default — they can untick it — and they may add screenshots or other files. The current settings and any warnings on screen go into the email body. POST /api/feedback receives the form and sends it with nodemailer over SMTP, rate-limited per client and guarded by a honeypot field; without SMTP credentials it logs the message in dev and answers 503 in production.

Configure with SMTP_HOST, SMTP_USER, SMTP_PASS (optionally SMTP_PORT, default 465), EMAIL_FROM and FEEDBACK_TO — see .env.example. Production uses Resend's SMTP relay with a sender on the verified kicadtogcode.com domain. The Dockerfile raises adapter-node's BODY_SIZE_LIMIT to 25 MB so attachments fit.

Usage counts

Anonymous, cookie-free counts go to GoatCounter: page views, plus three events, board-converted, sample-converted and output-downloaded. Regenerating after a settings change isn't counted. src/lib/analytics.ts only ever sends those fixed names, never anything from the board, including its name. Results are at grserwe.goatcounter.com.

The site code comes from PUBLIC_GOATCOUNTER_CODE, set in fly.toml. Without it nothing loads, and the note on the landing page saying what is counted disappears too. GoatCounter's script also ignores localhost, so local development never adds to the numbers.

Architecture

  • SvelteKit + TypeScript + Tailwind 4, adapter-node, no database, no auth. The only server code is src/routes/api/feedback/ and src/lib/server/email.ts.
  • The conversion engine is a pure, framework-free TS library in src/lib/engine/ (sexpr/ tokenizer → parser/ → model/ → geometry/ → toolpath/ → gcode/, plus profile/ for the board cutout and silkscreen/ for the laser SVG), runnable in the browser worker and in vitest.
  • Deployed on Fly.io via GitHub Actions (.github/workflows/deploy.yml): checks on every push/PR, deploy on master.

Parts

2
QtyValueFootprintReferences
2Conn_01x02_MaleConnector_PinHeader_1.00mm:PinHeader_1x02_P1.00mm_VerticalJ1, J2

More from grserwe/KiCadToGCodeSvelte

1
  • 2 layers145 × 100 mmShowerController, the printed circuit board in 3D

    ShowerController

    grserwe/KiCadToGCodeSvelte

    Convert KiCad PCB designs into CNC GCode for isolation-engraving traces on copper-clad board and drilling through-holes — entirely in the browser.

    22 parts

Similar boards

  • 2 layers37 × 19 mmPassive rpi hub75-adapter, the printed circuit board in 3D

    Passive rpi hub75-adapter

    hzeller/rpi-rgb-led-matrix

    Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO

    2 parts4.4kGPL-2.0
  • 2 layersDiode template, the printed circuit board in 3D

    Diode template

    adamws/kicad-kbplacer

    KiCad plugin for automatic keyboard's key placement and routing

    2 parts547GPL-3.0
  • 2 layers20.3 × 15.2 mmL0 button, the printed circuit board in 3D

    L0 button

    Luos-io/luos_engine

    Open-source and real-time orchestrator for cyber-physical-systems, to easily design, test and deploy embedded applications and digital twins.

    2 parts546MIT
  • 2 layers35.1 × 46.8 mmSDEX2M2 Breakout Board, the printed circuit board in 3D

    SDEX2M2 Breakout Board

    NVNTLabs/switch2-SDEX2M2

    Micro SD Express to M.2 NVME Adapter for Nintendo Switch 2

    2 parts542GPL-3.0
  • 2 layers59.3 × 36.6 mmExpansionBoardTemplate, the printed circuit board in 3D

    ExpansionBoardTemplate

    BlueSCSI/BlueSCSI-v2

    BlueSCSI v2/Ultra - an open source, open hardware, SCSI emulator using the Pi Pico PR2040 and Pico 2 RP2350

    2 parts459GPL-3.0
  • 2 layersAlpha.9mm.wire, the printed circuit board in 3D

    Alpha.9mm.wire

    ohmtech-rdi/eurorack-blocks

    Software to Hardware Prototyping for Eurorack using C++, Max/Gen~ or Faust

    2 parts410
  • 2 layers26.7 × 64 mmGpu power, the printed circuit board in 3D

    Gpu power

    dennisss/dacha

    Monorepo for awesome tools/projects/libraries

    2 parts397Apache-2.0

Questions

How big is the TopAndBottomLayer PCB?

It measures 21.6 × 8.3 mm and has 2 copper layers, 1.6 mm thick.

What parts does the TopAndBottomLayer use?

2 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the TopAndBottomLayer KiCad files?

From the grserwe/KiCadToGCodeSvelte repository on GitHub, at the commit this page was made from: the board is src/lib/engine/__fixtures__/TopAndBottomLayer.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the TopAndBottomLayer design in my own project?

Its repository states no licence, so its author keeps all rights: ask grserwe before reusing the design.