Threadsmith Stitch File Writer

Write DST, PES, JEF or EXP embroidery machine files from a stitch list or a Threadsmith project.

[[x, y], [x, y, "jump"], [x, y, "trim"], [x, y, "color"], …] in mm (y down), or {"cmds": […], "colors": [{"name", "hex"}]} from threadsmith-digitize.

More options

If given, the project is digitized first.

PES/JEF: how thread colours of a stitch list are matched to the machine chart. A project keeps the method it was saved with.

Try an example: · · ·

More about this tool

Part of Threadsmith

How it works

Encodes stitches as a Tajima DST (512-byte header, balanced-ternary 3-byte records, jumps split to ≤ 12.1 mm, colour changes, trims as zero-sum jumps, END), Brother PES (v1 wrapper around the PEC stitch block with thread palette indices and thumbnails, real trim flags), Janome JEF (header with hoop, extents and Janome thread indices) or Melco EXP file. The file is decoded again to verify every stitch position before you download it.

  • Coordinates are rounded to 0.1 mm on absolute positions, so rounding never accumulates; each move becomes the difference to the previous rounded position.
  • DST: each axis is written in balanced ternary with digits for 1, 3, 9, 27 and 81 (±121 max). Byte 3 = 0x03 | flags: 0x80 jump, 0xC0 colour change; END = 00 00 F3. Longer moves are split into equal records. Y is inverted (DST is y-up).
  • Trims are written as three jumps (+2,+2) (−4,−4) (+2,+2) that cancel out — the convention machines use to trigger a trim after a run of jumps.
  • Header: LA label, ST record count, CO colour changes, ±X/±Y extents in 0.1 mm, AX/AY end offset, MX/MY 0, PD ******, 0x1A, padded with spaces to 512 bytes.
  • EXP: 2 signed bytes per stitch (±127), 0x80 0x04 dx dy jump, 0x80 0x01 colour change; trims as three zero-sum jumps.
  • PES: "#PES0001" + PEC offset + empty v1 object section, then the PEC block every Brother/Babylock machine reads: 512-byte header with label, colour count and the nearest of the 64 PEC palette threads per colour block; stitches as 7-bit short or 12-bit long moves (0x1000 jump, 0x2000 trim flag), FE B0 colour change, FF end; 48×38 1-bit thumbnails. Y is down.
  • Machine chart colours (PES/JEF) are the nearest chart entry by CIEDE2000 (ΔE2000, CIE Lab D50 from the shared Lumina colour engine), or by weighted RGB ("redmean") for projects saved before 2026.11.38 and when colorMatch is redmean. Ties keep the lower chart index.
  • JEF: 116-byte little-endian header (stitch offset, date, colour and point counts, hoop code, extents, edge distances to the 110×110 / 50×50 / 140×200 / custom hoops) + nearest Janome thread index per colour; stitches as 2 signed bytes (y up), 80 02 jump, 80 01 colour change, 80 10 end; trims as a zero jump.

DST and EXP carry no thread colours; PES and JEF store the nearest colour of the machine’s own thread chart, which is only an approximation. Use the colour list from Threadsmith to thread the needles. Test on scrap fabric first.

Sources

Part of Threadsmith

  • Threadsmith Embroidery digitizing studio

    Draw or import artwork, turn it into stitches, export DST, PES, JEF or EXP files.

    Open Threadsmith

Related tools

  • Threadsmith Digitizer – Turn shapes, SVG paths, text or a whole project into embroidery stitches with stats and preview.
  • Threadsmith Design Stats – Stitch count, colours, trims, thread, sewing time and density of a DST, PES, JEF or EXP file.

How to use the Threadsmith Stitch File Writer

Write a stitch list or Threadsmith project as a Tajima DST, Brother PES, Janome JEF or Melco EXP embroidery file, verified by decoding it again.

What it is for

Embroidery machines read their own file formats: Tajima DST is the industrial standard, Brother and Babylock home machines read PES, Janome uses JEF and Melco uses EXP. Stitches generated in a script or digitized with Threadsmith still need a file your machine accepts, with jumps, trims and colour changes encoded the way it expects.

Paste a stitch list ([[x, y], [x, y, "jump"], [x, y, "trim"], [x, y, "color"], …] in millimetres, y pointing down) or a Threadsmith project, choose the format and an 8-character label, and the tool writes the file. Long moves are split into records the format can hold, and trims are written the way machines recognise them. The file is then decoded again and every stitch position is compared with the input before you download it.

DST and EXP carry no thread colours. PES and JEF store the nearest colour from the machine's own thread chart, which is only an approximation. Test on scrap fabric first.

Worked example

The first example is a tiny hand-written design: a 10 mm square outline, a 30 mm jump to the right, a colour change and a small triangle, written as DST with the label SQUARE.

stitches.dst: 551 bytes · Stitch records: 8 · Jump records: 3 · Colour changes: 1. Round-trip verified.

The 30 mm jump became three jump records of 10 mm each, because one DST record can move at most 12.1 mm. The header shows LA:SQUARE, ST: 12, CO: 1 and extents of +X 400 and −Y 100 in 0.1 mm units. The record table decodes the first bytes, for example 09 04 07 = stitch 10 mm right and 09 04 87 = the same move as a jump. Maximum position error after decoding: 0 mm.

The third example writes the botanical-leaf template project as PES: 5,989 bytes, 2,230 stitch records, 15 jumps and 2 colour changes, verified with a maximum error of 0.07 mm. The machine threads chosen for the three colours were Emerald Green (54), Peacock Blue (38) and Pewter (19). The design's walnut brown came out as Pewter, a grey, because that was the closest match in Brother's 64-colour chart. So thread the needles from Threadsmith's colour list, not from the machine screen.

How to read the result

  • Bytes, records: file size and the number of stitch, jump and colour-change records.
  • Split stitches: moves that were too long for one record and were split.
  • Verified / max error: whether the decoded file matches your input, and the largest difference after rounding to 0.1 mm.
  • Header (DST): label, record count, colour changes and extents as the machine will read them.
  • Machine threads (PES, JEF): the palette index and name stored per colour block.

Tips and common mistakes

  • Coordinates are millimetres with y down. DST, EXP and JEF are y-up, and the writer flips y for you. Don't flip it yourself.
  • Use "trim" where you want the thread cut. DST and EXP have no trim command, so the writer uses three jumps that cancel out, which most machines treat as a trim.
  • "color" marks a colour change at that point. Put it after the jump to the next colour's start, as in the example.
  • The label is limited to 8 characters.
  • DST and EXP carry no thread colours at all. Keep a colour list with the file.

FAQ

Which format should I choose?

Whatever your machine reads: PES for Brother and Babylock, JEF for Janome, DST for most commercial machines, EXP for Melco.

Can I write a file straight from a Threadsmith project?

Yes. Paste the project JSON; it's digitized first, then written in the chosen format.

Why does my machine show different colours?

DST and EXP store none. PES and JEF store the nearest thread from the brand's chart by ΔE2000, which can still be far from your intended colour. Projects saved before November 2026 keep the older weighted-RGB pick; set Thread colour matching for plain stitch lists.

What does "Round-trip verified" mean?

The written file was decoded again and every stitch landed within the 0.1 mm format precision of your input.

Guide last updated:

For scripts and AI agents

  • JSON API: POST https://threadsmithstitchfile.usefulweb.site/api/v1/calculate (same calculation as this page)
  • Interface description: OpenAPI 3.1 · AI guide: llms.txt
  • MCP server (Streamable HTTP): https://threadsmithstitchfile.usefulweb.site/mcp · tool name threadsmith_stitch_file
Example request
curl -s -X POST https://threadsmithstitchfile.usefulweb.site/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{"format":"dst","label":"SQUARE","stitches":"[[0,0],[10,0],[10,10],[0,10],[0,0],[30,0,\"jump\"],[30,0,\"color\"],[30,0],[40,5],[30,10]]"}'
Feedback · ideas & bug reports welcome