Website · Playground · Models · Docs · npm
Write a part once as code, change a number, and get a new cut file. KerfScript is to laser cutters what OpenSCAD is to 3D printers, except it was designed for flat parts from the start: cut, score and engrave layers, kerf compensation, finger joints, living hinges, parts and sheets are part of the language.
The playground runs the interpreter in your browser. A comment after a number turns it into a slider.
Example
|
|
npx @mylasertools/kerfscript render box.kerf -o box.svg -D width=200
That writes all six panels packed on a sheet, kerf compensated, as a millimetre SVG with one layer per operation. Output is checked automatically in Inkscape; see docs/compatibility.md for what has and has not been tested in other laser software.
Made with KerfScript
Every model is a file in examples/. The pictures show the cut parts put together, built in Blender from KerfScript's own output (site/3d). Open one on the website to turn it around in 3D, change its settings and download the SVG or DXF, or copy it as the start of your own design.
![]() Hadal sculpture 13 slotted parts, ribs computed from lists |
![]() Tilt maze a new maze for every seed, by recursion |
![]() Layered island contours traced from a height formula |
![]() Fractal tree a module that calls itself |
![]() Round badge text set letter by letter around a circle |
![]() Winterlight ornaments one-piece ornaments with scored detail |
![]() Xenospora seed pod 16 parts on 3 sheets, one file per sheet |
![]() Solstice lantern tabs, slots and a fit test piece |
![]() Finger-jointed box six panels from one library call |
![]() Wave Cathedral 17 different ribs from one formula |
![]() Gift tags from a list one tag per name, each name fitted |
![]() Umbra shadow machine six fins whose shadows make one dragon |
Why a new language
- Laser concepts are built in.
engrave(),score()andcut()put geometry on machine layers. Engraving is clipped to the material, inner cuts come before outer ones, and the whole part is offset by half the kerf. - Parts, not just shapes.
part("lid", qty = 2)names a piece; the renderer packs parts by material and thickness onto sheets. - Joinery that fits.
finger_rect,finger_holes,tslotandliving_hingeuse$thickness, so changing the material keeps joints tight. - Familiar syntax. If you know OpenSCAD, you can read KerfScript. The customizer comments are the same, so editors that understand OpenSCAD parameters understand KerfScript ones.
- Runs anywhere. Pure TypeScript with no native code: the same interpreter runs in browsers, Node, workers and the command line.
- Safe to run. Programs read libraries only through the resolver you provide. Step and recursion limits stop runaway programs, and errors name the line.
Install
npm install @mylasertools/kerfscript
Command line
kerf render design.kerf -o design.svg # or .dxf / .json
kerf render design.kerf -D width=200 -D 'label="Oak"' --font Inter.ttf
kerf render design.kerf --sheet 400x300 --kerf 0.1 --split
kerf params design.kerf # customizer parameters as JSON
kerf check design.kerf # parts, sizes, cut length, warnings
Library
import { render, parameters } from '@mylasertools/kerfscript';
const result = render(source, {
params: { width: 200 },
fonts: { inter: await (await fetch('/Inter.ttf')).arrayBuffer() },
sheet: [600, 400],
});
result.svg; // all sheets in one SVG
result.sheets; // [{ width, height, material, thickness, svg, dxf, items }]
result.parts; // [{ name, qty, width, height, pieces, cutLength, thickness, kerf, material }]
result.warnings; // e.g. a part that falls apart, or one bigger than the sheet
result.echoes; // echo() output
parameters(source).parameters; // [{ name, caption, group, type, initial, min, max, step, options, span }]
Errors are thrown as KerfError with line and col.
Learn the language
- Getting started, then the guides on layers, kerf, parts and sheets, settings, the command line and the JavaScript API
- Coming from OpenSCAD: what is the same and what is not
- LANGUAGE.md: the full language reference
- Versions: language and package versions, and what stays stable before 1.0
- examples/: every model on the website, including a calibration square and a kerf test
Website
kerfscript.mylasertools.com is an Astro site in site/, deployed to Cloudflare as a static assets Worker. Every model picture and the guides are built from examples/, docs/ and LANGUAGE.md by this version of KerfScript.
The site also publishes llms.txt,
a full text bundle, and a
Markdown companion at index.md under every public page path. The guides and
model companions are generated from the same source as their HTML pages. Each
HTML page advertises its Markdown version with a rel="alternate" link.
Markdown responses point back to the matching HTML URL with a canonical HTTP
header, so the HTML page remains the preferred Search result.
The site's robots.txt permits all cooperating crawlers. Cloudflare's bot
controls must also allow requests to the hostname for a crawler to reach it.
npm --prefix site install
npm run site # build KerfScript, then the site into site/dist
npm run site:serve # preview on http://localhost:4321
npm --prefix site run deploy
npm run readme-images # redraw the model pictures in this README
Checking output
npm run compat renders a reference set of models and opens every SVG and
DXF in Inkscape to check sizes, layers and fills.
Community
Bug reports, cut reports and ideas are welcome; see CONTRIBUTING.md, the roadmap, SECURITY.md and the code of conduct.
Licence
Copyright (c) 2026 MyLaserTools.
KerfScript is free software under the
GNU AGPL 3.0, with an additional permission
that makes your .kerf designs and the files KerfScript generates yours to
license and sell however you like.
A commercial licence is available for proprietary integrations or different terms. Private changes do not require one; see what the AGPL means for you for how it applies to hosted services.
"KerfScript" is a trademark of MyLaserTools; see TRADEMARKS.md. Contributions need the CLA; see CONTRIBUTING.md. Bundled third-party code is listed in THIRD-PARTY-NOTICES.md.













