Introduction
A .kicad_mod file holds one footprint for KiCad: the copper pads, outlines and text that a component needs on a circuit board. A footprint library is a folder of these files. The text is UTF-8 in the S-expression syntax of KiCad board files, and the format dates from KiCad 4.0. This page follows what the KiCad 10.0 program writes (format version 20260206), notes where 9.0 (20241229) differs, and lists the older forms the 10.0 reader accepts. The items that fill a footprint are on three further pages: pads, graphics and text, and zones and groups.
File structure
(footprint "NAME"
(version 20260206)
(generator "pcbnew")
(generator_version "10.0")
[(locked yes)] [(placed yes)]
(layer "F.Cu")
[(descr "…")] [(tags "…")]
(property "NAME" "VALUE" …) …
[(component_classes (class "…") …)]
[(property ki_fp_filters "…")]
[(sheetname "…")] [(sheetfile "…")]
[(units (unit (name "A") (pins "1" "2" …)) …)]
[(solder_mask_margin M)] [(solder_paste_margin M)]
[(solder_paste_margin_ratio R)] [(clearance C)] [(zone_connect N)]
[(attr FLAG …)]
[(stackup (layer "NAME") …)]
[(private_layers "…" …)]
[(net_tie_pad_groups "…" …)]
(duplicate_pad_numbers_are_jumpers yes|no)
[(jumper_pad_groups ("1" "2" …) …)]
[graphics and text …]
[(point …) …]
[(pad …) …]
[(zone …) …]
[(group …) …]
[(variant …) …]
(embedded_fonts yes|no)
[(embedded_files …)]
[(model …) …])Square brackets mark optional parts; they are not in the file. This is the order the program writes. The version comes first because it controls how later items are read. Compared with a footprint placed on a board, a library file has the bare name without a library prefix, carries its own version and generator, and leaves out the footprint's position (at), its own uuid, its schematic path and pad nets, pin functions and pin types. Other programs are asked not to name themselves pcbnew as generator.
- Lengths are in millimetres and angles in degrees. Coordinates are relative to the footprint's origin.
- Comment lines may stand before the opening bracket; the program keeps them.
- A file with a version newer than the program knows is reported as made by a newer version.
- Layer names are the untranslated names such as
F.Cu,F.SilkSandF.CrtYd; user layers areUser.1onwards and inner copperIn1.Cuonwards.
Header items
| Item | Meaning |
|---|---|
version | format version, a date written as a number |
generator, generator_version | writing program and its version; generator_version dates from KiCad 8 |
locked, placed | booleans; a library footprint is unlocked when loaded |
layer | side of the board: B.Cu is the back, any other value the front |
uuid, at X Y [ANGLE] | identifier and position; boards only |
descr, tags | description and search keywords |
path | link to the schematic symbol; boards only |
sheetname, sheetfile | schematic sheet the part comes from |
component_classes | a list of (class "NAME") items (version 20240928) |
property ki_fp_filters | footprint name filters carried over from the symbol |
units | named groups of pins, for swapping the gates of a multi-unit part (version 20250909) |
Fields
(property "NAME" "VALUE"
[(locked yes)]
(at X Y [ANGLE]) [(unlocked yes)]
(layer "NAME" [knockout])
[(hide yes)]
(uuid "…")
(effects …)
[(render_cache …)])Fields such as Reference, Value, Datasheet and Description and any added by the user are text items; the parts after the value are those of text. A property with the name of an existing field sets that field. A new user field with no layer goes on F.Fab or B.Fab. A property called Footprint is read and discarded.
Local settings
solder_mask_margin,solder_paste_margin,solder_paste_margin_ratioandclearanceoverride the board rules for this footprint; absent means inherited. In files of version 20240201 or earlier, zero also meant inherited.zone_connect: 0 no connection, 1 thermal reliefs, 2 solid, 3 thermal reliefs for through-hole pads only.stackupis written only when the footprint defines its own layer set instead of stretching to the board's inner layers (version 20250818). It lists the layers; the copper layers must be an even number without gaps, and other technical layers are not allowed.private_layersnames layers whose contents show only in the footprint editor. In files older than 20220427,Edge.CutsandMarginare removed from the list.- Each string in
net_tie_pad_groupsis a comma-separated list of pads that are allowed to short different nets together. duplicate_pad_numbers_are_jumpersandjumper_pad_groupsdeclare pads that are connected inside the part (version 20250324).
Attributes
attr is a list of flags.
| Flag | Meaning |
|---|---|
smd | surface-mounted part |
through_hole | through-hole part |
board_only | has no symbol in the schematic |
exclude_from_pos_files | left out of placement files |
exclude_from_bom | left out of the bill of materials |
allow_missing_courtyard | no courtyard is required |
dnp | do not populate |
allow_soldermask_bridges | mask openings may join pads |
Variants
(variant (name "NAME")
[(dnp yes|no)] [(exclude_from_bom yes|no)] [(exclude_from_pos_files yes|no)]
[(field (name "Value") (value "100nF")) …])KiCad 10.0 stores assembly variants (version 20260101). Only settings and field values that differ from the footprint's own are written. A variant without a name, or a field with an empty name, is ignored.
3D models
(model "FILE"
[(hide yes)] [(opacity N)]
(offset (xyz X Y Z))
(scale (xyz X Y Z))
(rotate (xyz X Y Z)))The file name may use path variables. offset is in millimetres. The older at list, replaced by offset in 2017 (versions 20171114 and 20171130), is always read as inches.
Embedded files and fonts
(embedded_fonts yes|no)
(embedded_files
(file (name "NAME")
(type datasheet|font|model|worksheet|other)
[(data |BASE64
BASE64|)]
(checksum "HASH")) …)- The data is the file compressed with Zstandard and encoded as Base64 in lines of 76 characters, with a
|before the first and after the last. The bar is a token of its own from version 20240706. - The checksum is a MurmurHash3 of the uncompressed file; a 64-character value is checked as SHA-256.
- A footprint inside a board is written without the
data. An emptydatalist, which KiCad 9.0.0 could write by mistake, is accepted. Errors in this block only cause a warning when a footprint is read.
Versions
The version numbers are those of the board format; the board page groups them by KiCad release. Changes that matter for footprint files:
| Version | Change |
|---|---|
| 20171114, 20171130 | 3D model offset saved in millimetres; written as offset |
| 20190331, 20190421, 20190907 | Chamfered rounded pads; curves in custom pads; rule areas in footprints |
| 20191123, 20200104 | Pad pin function; pad properties |
| 20200724, 20200808, 20200809 | Footprint identifiers; footprint properties; removal of unused pad layers |
| 20200828, 20200829 | New fabrication attributes; library name removed from exported footprints |
| 20201002, 20201115, 20201116 | Groups in footprints; root module renamed footprint and new fill syntax; version and generator in footprint files |
| 20211014, 20211227, 20211228 | Three-point arcs; thermal spoke angle; allow_soldermask_bridges |
| 20211229, 20211230, 20211231, 20211232 | stroke; dimensions in footprints; private layers; fonts |
| 20220131, 20220225, 20220308 | Text boxes; tedit removed; knockout and locked text |
| 20220621, 20220818, 20221018 | Images; net ties; zone layer connections |
| 20230410, 20230517, 20230620 | Do-not-populate flag; teardrop settings; fields as properties |
| 20231212, 20231231, 20240108 | Yes/no booleans; uuid replaces id; teardrop booleans |
| 20240201, 20240202, 20240609 | Overrides may be absent; tables; tenting |
| 20240706, 20240928, 20240929 | Embedded files; component classes; complex padstacks |
| 20250222, 20250324, 20250811 | Hatched shapes; jumper pads; press-fit property |
| 20250818, 20250829, 20250901 | Custom layer sets; rounded rectangles; points |
| 20250909, 20250914, 20250926, 20251027 | Footprint units; barcodes; via type changes; die delay scaling |
| 20251028, 20251101, 20260101, 20260206 | Net codes no longer written; backdrill; variants; barcode and variant attributes |
Older forms
(module …)as the root, from before version 20201115, often with unquoted strings.tstampforuuid;tedit,autoplace_cost90,autoplace_cost180and footprint-levelthermal_widthandthermal_gapare read and ignored.solder_paste_ratioforsolder_paste_margin_ratio.attr virtual, from before version 20200826, means bothexclude_from_pos_filesandexclude_from_bom. In those files a footprint whoseattrgives no type and none ofvirtual,board_only,exclude_from_pos_files,exclude_from_bomanddnpis taken as through-hole.- In files of version 20220815 or earlier, a footprint whose
tagsbegin withnet tiebecomes a net tie joining all its pads. - Before version 20230620, properties were plain name and value pairs.
ki_keywordsandki_lockedare skipped,ki_descriptionfills theDescriptionfield,SheetnameorSheet nameandSheetfileorSheet fileset the sheet items, and other fields are hidden. Reference and value were thenfp_textitems. - Booleans such as
lockedandplacedmay be a bare word or a list without a value, both meaning yes;trueandfalseare accepted as well asyesandno. - In
layerslists, the namesInner1.CutoInner14.Cuof the first S-expression files are read asIn14.Cudown toIn1.Cu.
Divergence from spec
The KiCad developer documentation gives the header as footprint, version and generator and covers KiCad 6.0 onwards. The 10.0 program also writes generator_version, embedded_fonts, jumper settings and, where used, units, variants, a footprint stackup, embedded files and component classes.
KiCad 9.0 and 10.0
- 9.0 writes version 20241229, 10.0 version 20260206.
- 9.0 numbers nets:
(net CODE "NAME")on pads,(net CODE)on shapes, and(net CODE) (net_name "NAME")on zones. - 9.0 writes tenting as bare words and always writes
(filled_areas_thickness no)on zones. - 9.0 tables have no
uuid. - New in 10.0 for the footprint as a whole: points, barcodes, variants, units, a footprint
stackupand the two jumper pad items. - New in 10.0 for drawing items and zones: rounded rectangles, hatched shape fills,
knockouton text boxes, alib_idon groups, a group as placement source and per-layer zone properties. 9.0 also writes nolockedon a field. - New in 10.0 for pads: backdrill and tertiary drill, post-machining, die delay and the press-fit property.
Reading the file
- A footprint file begins
(footprintfollowed by the name. Files from before KiCad 6 begin(module, may have noversion, and quote strings only where needed. - Read the whole file as one S-expression; line breaks and indentation carry no meaning.
- The older
.modlibraries of KiCad are a different, line-based format.
In the explorer
A dropped .kicad_mod file shows its lists as a byte tree and a drawing of the footprint: graphic items, texts, fields, text boxes, tables, dimensions, points, barcodes, zones and pads with their holes and numbers. Options choose the layers and the size of the picture. A click in the picture selects the bytes of the item. Tables list the pads, graphic items, fields, zones, groups, 3D model locations and the values of a footprint stack-up. PNG and JPEG images are painted in the drawing. Embedded files and images open as files of their own, and the checksum of each embedded file is compared with its data.
Solder mask and paste layers show pads with the margins the footprint sets. A layer choice picks the matching padstack entry of a pad; with all copper layers shown, the other entries are outlined in their layer’s colour. Backdrills and post-machining are marked in the colours of the layers they reach, and zone outlines carry their edge or full hatching.
Files up to 400 MB are read. At most 2,000,000 points where zone hatch lines meet an outline are worked out for one zone.
Not described
The development branch after KiCad 10.0 may write newer versions; this page covers the 9.0 and 10.0 releases.
Known, not yet covered
- Viewer: text without a stored outline is drawn in the site’s own stick font, not in KiCad’s fonts. The stick font has ASCII, accented Latin letters and some common signs; other characters show as boxes.
- Viewer: barcodes are encoded by the viewer, so their modules can differ from KiCad’s for the same text; Data Matrix uses its ASCII scheme only and so can come out larger.
- Viewer: images other than PNG and JPEG are drawn as crossed frames.
- Viewer: the text of text boxes and table cells in a rotated or flipped footprint is not always placed inside its box.
- Viewer: hatched fills of graphic shapes use the viewer’s own spacing, and dimension arrows and extensions are simplified.
- Viewer: pads are drawn on every layer they name, also where the footprint asks for unused copper to be removed.
Links
Software
- KiCad – free electronics design suite (Windows, macOS, Linux)
Developers
- KiCad source code – the footprint reader and writer are in
pcbnew/pcb_io/kicad_sexpr(C++, GPL)
Reference
- Footprint library file format – KiCad developer documentation
- S-expression format introduction – footprint and pad syntax