.KICAD_SYM File Format

KiCad symbol library

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 \v give the usual control characters, \x takes 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 text items, where they are in tenths of a degree.
  • Booleans are yes or no. 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" …)
  …)
  • version comes 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, symbol and the old host. (host NAME) was the earlier form of generator; 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_sym files. 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 …)])
ItemMeaningSince
powerpower symbol; global (also meant by a bare power, the form of KiCad 9.0) or locallocal: 20250227
body_stylesthe symbol has several body styles: demorgan for the normal and De Morgan pair, or a list of style names20250827
pin_numbers, pin_nameshide pin numbers or names; offset is the distance of names inside the body, 0.508 mm when not given
exclude_from_simleft out of simulation
in_bom, on_boardlisted in the bill of materials; placed on the board20200908
in_pos_fileslisted in component position filesKiCad 10.0
duplicate_pin_numbers_are_jumperspins with the same number are joined inside the part20250324
jumper_pin_groupseach inner list names, in quoted strings, pins joined inside the part20250324
embedded_fontsfonts used are stored in embedded_files20240529
  • 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_name gives 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, required and anchor. 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_1 to NAME_9, and further copies are dropped.
  • KiCad 9.0 writes show_name and do_not_autoplace as bare lists, (show_name), only when set, and puts hide inside effects. 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. mirror is accepted and ignored on schematic and symbol text.
  • thickness is written only when it is not automatic.
  • href must be empty, a page link inside the schematic, or a URL with a scheme.
  • Older files write bold, italic and hide as 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:

NameValue
ki_keywordssearch keywords
ki_fp_filtersfootprint name filters, separated by white space; a space within a filter is written {space}
ki_lockedpresent when the units are not interchangeable
ki_descriptionthe 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 hide as a bare word.
  • Before version 20250318 a name or number of ~ means empty. Before 20210606 both use the old overbar form.
  • The electrical type unconnected is the old word for no_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 typeMeaning
input, output, bidirectionallogic signals
tri_stateoutput that can be high impedance
passivepassive terminal
freenot connected inside; may be wired
unspecifiedno type given
power_in, power_outsupply input and output
open_collector, open_emitteropen outputs
no_connectmust 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.
  • radius on a rectangle rounds its corners (version 20250829).
  • outline fills with the line colour and background with the body background colour. color and the three hatch types (from schematic version 20250222; not in KiCad 9.0) are written with a color.
  • 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 mid is built from the centre and angles in degrees; length is 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°.
  • start and end on a text box date from KiCad 6.99 development and carry no angle. A box without margins gets the old default margin. A box needs end or size.

Embedded files

(embedded_files
  (file (name "NAME")
    (type datasheet|font|model|worksheet|other)
    (data |BASE64
      BASE64…|)
    (checksum "HASH")) …)
  • name comes first in each file.
  • 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_files block gives a warning and the symbol is still read.

File versions

VersionChange
20200126First version, with alternate pins
20200820, 2020082720200820 has no note; host tag removed
20200908, 20201005In bill of materials and on board flags; footprint filters separated by spaces
20210619, 20211014Overbar changed from ~…~ to ~{…}; arc format
20220101, 20220102, 20220126Class flags; fonts; text boxes
20220328, 20220331Text box start/end became at/size; text colours
20220914Unit display names; property ids no longer saved
20230620, 20231120Description field; generator_version and other changes for KiCad 8
20240529, 20240819Embedded files; MurmurHash3 checksums
20241209Private fields (KiCad 9.0)
20250318~ no longer means empty text
20250324Jumper pin groups
20250829, 20250901Rounded rectangles; stacked pin notation
20250925Bus aliases moved to the project file (schematics)
20251024New 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 write hide as a boolean.
  • The documentation gives properties an (id N) entry, which is no longer saved.

Reading the file

  • A library begins (kicad_symbol_lib followed by (version N).
  • Resolve each extends by 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