Introduction
A .kicad_sym file is a library of schematic symbols for KiCad: the drawings of components, with their pins and properties. It is UTF-8 text in an S-expression syntax and replaced the older .lib and .dcm pair with KiCad 6. The same symbol definitions are copied into each schematic file that uses them. This page gives the syntax that KiCad 10.0 writes (file version 20251024) and every older form its reader still accepts, including those of KiCad 9.0 (20241209).
Text syntax
- The file is a tree of lists in round brackets. Each list starts with a keyword. Spaces and line breaks separate items.
- Strings are in double quotes. Inside them a backslash escapes
"and\;\a \b \f \n \r \t \vgive the usual control characters,\xtakes one or two hexadecimal digits, and a backslash before one to three octal digits gives that byte. - A line whose first non-blank character is
#is a comment. - From version 20240529, and always inside
embedded_files,|is a separate token. Before that it could be part of an unquoted word. - Lengths are millimetres, held to 0.0001 mm. In a library the Y axis points up.
- Angles are in degrees, except on symbol
textitems, where they are in tenths of a degree. - Booleans are
yesorno. Colours are(color R G B A)with R, G and B from 0 to 255 and alpha from 0 to 1. - Square brackets and
|between words in the outlines below mark optional parts and choices; they are not in the file.
File structure
(kicad_symbol_lib
(version 20251024)
(generator "kicad_symbol_editor")
(generator_version "10.0")
(symbol "NAME" …)
…)versioncomes first. If it is missing, KiCad assumes its own current version. A version newer than the reader’s is refused.- The only other items at the top level are
generator,generator_version,symboland the oldhost.(host NAME)was the earlier form ofgenerator; before version 20200827 it had a second word, the program version. - KiCad writes symbols in order of inheritance depth, then name, so a parent comes before the symbols derived from it. KiCad 9.0 looks for a parent among the symbols already read; KiCad 10.0 links parents after reading the whole library.
- KiCad 10.0 can also keep a library as a folder of
.kicad_symfiles. Each file has the header above and holds one or more symbols; a new symbol gets a file named after it.
Symbols
(symbol "NAME"
[(power [global|local])]
[(body_styles demorgan | "STYLE1" "STYLE2" …)]
[(pin_numbers (hide yes))]
[(pin_names [(offset O)] [(hide yes)])]
(exclude_from_sim no) (in_bom yes) (on_board yes)
(in_pos_files yes)
(duplicate_pin_numbers_are_jumpers no)
[(jumper_pin_groups ("1" "2") ("3" "4") …)]
(property "Reference" "U" …)
(property "Value" "NAME" …)
(property "Footprint" "" …)
(property "Datasheet" "" …)
(property "Description" "" …)
…more properties…
(symbol "NAME_0_1" …graphics…)
(symbol "NAME_1_1" [(unit_name "TEXT")] …pins…)
(embedded_fonts no)
[(embedded_files …)])| Item | Meaning | Since |
|---|---|---|
power | power symbol; global (also meant by a bare power, the form of KiCad 9.0) or local | local: 20250227 |
body_styles | the symbol has several body styles: demorgan for the normal and De Morgan pair, or a list of style names | 20250827 |
pin_numbers, pin_names | hide pin numbers or names; offset is the distance of names inside the body, 0.508 mm when not given | |
exclude_from_sim | left out of simulation | |
in_bom, on_board | listed in the bill of materials; placed on the board | 20200908 |
in_pos_files | listed in component position files | KiCad 10.0 |
duplicate_pin_numbers_are_jumpers | pins with the same number are joined inside the part | 20250324 |
jumper_pin_groups | each inner list names, in quoted strings, pins joined inside the part | 20250324 |
embedded_fonts | fonts used are stored in embedded_files | 20240529 |
- A symbol name is a library item name. Old files may write
{slash}for/in symbol, unit and parent names; KiCad turns it back. - Nested symbols are named
NAME_UNIT_STYLE, with the symbol’s own name in front and two numbers. Unit 0 holds what all units share, and style 0 what all body styles share. With De Morgan styles, style 1 is the normal body and style 2 the alternative one. The unit count is the highest unit number used. unit_namegives a unit a display name.- Drawing items and pins may also stand directly in the outer symbol; they belong to unit 1, style 1.
- Before version 20250827 there is no
body_styles: KiCad takes the symbol to have a De Morgan body if drawings for it exist. Drawings for styles beyond the declared count are dropped. - The keyword list also has
atomic,requiredandanchor. KiCad 10.0 neither writes nor reads them in a symbol (the writer only notes them as future work).
Derived symbols
(symbol "CHILD" (extends "PARENT")
(property …) …
(embedded_fonts no)
[(embedded_files …)])A derived symbol takes its drawing and pins from the parent and has its own properties and embedded files.
Properties
(property [private] "NAME" "VALUE"
(at X Y ANGLE)
(show_name no)
(do_not_autoplace no)
[(hide yes)]
(effects …))private(version 20241209) marks a field shown only in the symbol editor.- The name may not be empty. An empty value is allowed; before version 20250318 a value of
~means empty. - Reference, Value, Footprint, Datasheet and Description are the mandatory fields, matched by name without regard to case. A second user field with a name already used is renamed
NAME_1toNAME_9, and further copies are dropped. - KiCad 9.0 writes
show_nameanddo_not_autoplaceas bare lists,(show_name), only when set, and putshideinsideeffects. The reader takes either form; bare means yes. - Old files have
(id N), a field number, which is ignored (not saved since 20220914).
Text effects
The same list is used on fields, text, text boxes and, for the size only, pin names and numbers.
(effects
(font [(face "NAME")] (size HEIGHT WIDTH) [(line_spacing R)]
[(thickness T)] [(bold yes)] [(italic yes)] [(color R G B A)])
[(justify [left|right] [top|bottom] [mirror])]
[(href "URL")]
[(hide yes)])- Without
justify, text is centred both ways.mirroris accepted and ignored on schematic and symbol text. thicknessis written only when it is not automatic.hrefmust be empty, a page link inside the schematic, or a URL with a scheme.- Older files write
bold,italicandhideas bare words. - Before version 20210606 an overbar was written
~text~; now it is~{text}. KiCad converts the old form in symbol text, Value fields, and pin names and numbers.
Special property names
These are saved as hidden properties but are settings of the symbol, not fields:
| Name | Value |
|---|---|
ki_keywords | search keywords |
ki_fp_filters | footprint name filters, separated by white space; a space within a filter is written {space} |
ki_locked | present when the units are not interchangeable |
ki_description | the description before version 20230620, now the Description field |
Pins
(pin ELECTRICAL SHAPE (at X Y 0|90|180|270) (length L) [(hide yes)]
(name "NAME" (effects (font (size H W))))
(number "1" (effects (font (size H W))))
(alternate "NAME" ELECTRICAL SHAPE) …)The position is the connection point. The angle gives the direction of the pin from it: 0 right, 90 up, 180 left, 270 down; no other values are allowed. Of the name and number text effects only the text height is kept. Each alternate offers another function for the same pin.
- Older files write
hideas a bare word. - Before version 20250318 a name or number of
~means empty. Before 20210606 both use the old overbar form. - The electrical type
unconnectedis the old word forno_connect(renamed at schematic version 20210123). - One pin can stand for several (stacked pin notation, version 20250901). The number is still one quoted string, written in square brackets as a comma-separated list of numbers and ranges, such as
[1,2,5-8]or[A1-A4,B2]. Both ends of a range need the same letter prefix and may not run downwards. A string that does not follow these rules is one ordinary pin number.
| Electrical type | Meaning |
|---|---|
input, output, bidirectional | logic signals |
tri_state | output that can be high impedance |
passive | passive terminal |
free | not connected inside; may be wired |
unspecified | no type given |
power_in, power_out | supply input and output |
open_collector, open_emitter | open outputs |
no_connect | must not be connected |
Shapes: line, inverted, clock, inverted_clock, input_low, clock_low, output_low, edge_clock_high and non_logic.
Graphics
A private keyword may follow the item name, marking graphics shown only in the symbol editor.
(arc (start X Y) (mid X Y) (end X Y) (stroke …) (fill …))
(circle (center X Y) (radius R) (stroke …) (fill …))
(rectangle (start X Y) (end X Y) [(radius R)] (stroke …) (fill …))
(polyline (pts (xy X Y) …) (stroke …) (fill …))
(bezier (pts (xy X Y) (xy X Y) (xy X Y) (xy X Y)) (stroke …) (fill …))
(text "TEXT" (at X Y TENTHS) (effects …))
(text_box "TEXT" (at X Y ANGLE) (size W H) (margins L T R B)
(stroke …) (fill …) (effects …))
(stroke (width W) (type default|solid|dash|dot|dash_dot|dash_dot_dot)
[(color R G B A)])
(fill (type none|outline|background|color|hatch|reverse_hatch|cross_hatch)
[(color R G B A)])- A Bézier has exactly four points: start, two control points, end.
radiuson a rectangle rounds its corners (version 20250829).outlinefills with the line colour andbackgroundwith the body background colour.colorand the three hatch types (from schematic version 20250222; not in KiCad 9.0) are written with acolor.- Text that is hidden is no longer supported as a drawing item: KiCad turns it into a hidden field.
Older arc and text box forms
(arc (start X Y) (end X Y)
(radius (at X Y) (length R) (angles A1 A2)) (stroke …) (fill …))
(text_box "TEXT" (start X Y) (end X Y) (stroke …) (fill …) (effects …))- An arc without
midis built from the centre and angles in degrees;lengthis ignored. The stored ends run the other way round, and KiCad swaps them, choosing the arc of at most 180°. - In files of version 20230121 or older, a three-point arc of more than 180° is taken to be wrong and replaced by its complement, and one of exactly 180° is bent to 179.5°.
startandendon a text box date from KiCad 6.99 development and carry no angle. A box withoutmarginsgets the old default margin. A box needsendorsize.
Embedded files
(embedded_files
(file (name "NAME")
(type datasheet|font|model|worksheet|other)
(data |BASE64
BASE64…|)
(checksum "HASH")) …)namecomes first in eachfile.- The data is the file compressed with Zstandard, then Base64, wrapped at 76 characters between two
|marks. - The checksum is of the uncompressed bytes: MurmurHash3 x64 128-bit with seed
0xABBA2345, written as 32 upper-case hexadecimal digits. A checksum of 64 characters is the older SHA-256 form (before version 20240819). A mismatch rejects the file. - KiCad 9.0.0 could write
(data)with nothing in it; the reader accepts this. - A field or other text refers to an embedded file as
kicad-embed://NAME. - In KiCad 10.0 a bad
embedded_filesblock gives a warning and the symbol is still read.
File versions
| Version | Change |
|---|---|
| 20200126 | First version, with alternate pins |
| 20200820, 20200827 | 20200820 has no note; host tag removed |
| 20200908, 20201005 | In bill of materials and on board flags; footprint filters separated by spaces |
| 20210619, 20211014 | Overbar changed from ~…~ to ~{…}; arc format |
| 20220101, 20220102, 20220126 | Class flags; fonts; text boxes |
| 20220328, 20220331 | Text box start/end became at/size; text colours |
| 20220914 | Unit display names; property ids no longer saved |
| 20230620, 20231120 | Description field; generator_version and other changes for KiCad 8 |
| 20240529, 20240819 | Embedded files; MurmurHash3 checksums |
| 20241209 | Private fields (KiCad 9.0) |
| 20250318 | ~ no longer means empty text |
| 20250324 | Jumper pin groups |
| 20250829, 20250901 | Rounded rectangles; stacked pin notation |
| 20250925 | Bus aliases moved to the project file (schematics) |
| 20251024 | New property layout: show_name, do_not_autoplace and hide as booleans in the property (KiCad 10.0) |
KiCad 10.0 writes these items that KiCad 9.0 does not: power global and power local, body_styles, in_pos_files, duplicate_pin_numbers_are_jumpers, jumper_pin_groups, rectangle radius and hatched fills.
Divergence from spec
- The KiCad developer documentation describes the KiCad 6 library. Later versions add
generator_version,exclude_from_sim, text boxes, private items, unit names, embedded files and the KiCad 10.0 items above, and writehideas a boolean. - The documentation gives properties an
(id N)entry, which is no longer saved.
Reading the file
- A library begins
(kicad_symbol_libfollowed by(version N). - Resolve each
extendsby parent name. In files that KiCad 9.0 must read, the parent comes first. - An unknown item is an error. KiCad 10.0 skips a symbol it cannot parse, warns, and then will not save over the library.
- The development branch after KiCad 10.0 may write newer versions; this page covers the 9.0 and 10.0 releases.
In the explorer
A dropped .kicad_sym file shows its lists as a byte tree and a drawing of one symbol: its graphic items, texts, text boxes, pins with their end marks, names and numbers, and its fields. Options choose the symbol, the unit, the body style, hidden pins and fields, and the size of the picture. A derived symbol is drawn with the drawings of its parent; when the parent is not in the file, its name and the place a library folder keeps it are shown. A click in the picture selects the bytes of the item. Tables list every symbol, pin, field, graphic item and embedded file, and embedded files open as files of their own; the checksum of each is compared with its data.
Files up to 400 MB are read. With more than 256 pairs of unit and body style, the first 256 are drawn side by side and each of the others by choosing it. A library of more than 4,096 symbols asks for the symbol’s row number instead of its name.
Not described
Known, not yet covered
- Viewer: text is drawn in the site’s own stick font, not in KiCad’s stroke font or in the fonts the file names or embeds. It has ASCII, accented Latin letters and some signs; other characters show as boxes.
- Viewer: colours, the place of pin names and numbers, the wrapping and default margins of text boxes and the spacing of hatched fills follow KiCad only approximately.
- Viewer: alternate pin functions and jumper pin groups are listed, not drawn, and stacked pin numbers are shown as written.
Links
Software
- KiCad – free electronics design suite (Windows, macOS, Linux)
Developers
- KiCad source code – the symbol library reader and writer are in
eeschema/sch_io/kicad_sexpr(C++, GPL)
Reference
- Symbol library file format – KiCad developer documentation
- S-expression format introduction – common syntax