Overview
KiCad uses S-expression (symbolic expression) based file formats for all native files. This provides:- Human-readable text format
- Version control friendly (meaningful diffs)
- Extensible structure
- Forward and backward compatibility
- Fast parsing performance
S-Expression Format
Syntax
S-expressions are nested lists enclosed in parentheses:Parser
Implementation:libs/sexpr/
Features:
- Recursive descent parsing
- Streaming support for large files
- Line number tracking for errors
- UTF-8 support
Native File Formats
Schematic Files (.kicad_sch)
Purpose: Store schematic design data
Structure:
- Header: Version, generator, UUID
- Page setup: Paper size, title block
- Symbol libraries: Embedded symbol definitions
- Instances: Placed symbols with properties
- Wiring: Net connections
- Annotations: Text, labels, notes
- Hierarchical sheets: Sub-schematics
Reference- Component reference (R1, C5, etc.)Value- Component valueFootprint- Associated PCB footprintDatasheet- Documentation URL- Custom fields - User-defined properties
PCB Files (.kicad_pcb)
Purpose: Store printed circuit board layout
Structure:
- Header: Version, generator
- General: Board properties (thickness, etc.)
- Layers: Layer stack definition
- Setup: Manufacturing parameters
- Nets: Electrical connectivity
- Footprints: Component placements
- Tracks/Vias: Copper routing
- Zones: Copper pours
- Drawings: Silkscreen, fabrication layers
Symbol Libraries (.kicad_sym)
Purpose: Reusable schematic symbol definitions
Structure:
_0_1- Graphical representation (body)_1_1- First unit pins_2_1- Second unit pins (for multi-unit symbols)
input- Input pinoutput- Output pinbidirectional- Bidirectional I/Otri_state- Tri-state outputpassive- Passive componentpower_in- Power inputpower_out- Power outputopen_collector- Open collectoropen_emitter- Open emitterunspecified- Unspecified
Footprint Libraries (.kicad_mod)
Purpose: PCB footprint definitions
Structure:
- F.Cu/B.Cu: Copper (front/back)
- F.SilkS/B.SilkS: Silkscreen
- F.Mask/B.Mask: Solder mask
- F.Paste/B.Paste: Solder paste (stencil)
- F.Fab/B.Fab: Fabrication layer
- Dwgs.User: User drawings
- Cmts.User: Comments
- Edge.Cuts: Board outline
thru_hole- Plated through-holesmd- Surface mountconnect- Connection point (no copper)np_thru_hole- Non-plated hole
circle- Circularrect- Rectangularoval- Ovaltrapezoid- Trapezoidalroundrect- Rounded rectanglecustom- Custom shape polygon
Project Files (.kicad_pro)
Purpose: Project settings and metadata
Format: JSON (exception to S-expression)
Structure:
Library Tables
Symbol Library Table (sym-lib-table)
Purpose: Define symbol library locations
Format: S-expression
- Global:
~/.config/kicad/8.0/sym-lib-table - Project:
project/sym-lib-table
Footprint Library Table (fp-lib-table)
Purpose: Define footprint library locations
KiCad- Native.prettydirectoriesGitHub- Remote GitHub repositoriesLegacy- Old.modformat
Auxiliary File Formats
Design Rules (*.kicad_dru)
Purpose: Custom design rule definitions
Format: S-expression
Worksheets (.kicad_wks)
Purpose: Drawing sheet/title block templates
Format: S-expression
Elements:
- Lines, rectangles, polygons
- Text with variable substitution
- Images/logos
- Page numbering
3D Model Files
Supported formats:- STEP (
.step,.stp) - Industry standard CAD - VRML (
.wrl) - 3D mesh format - X3D (
.x3d) - XML-based 3D
- Environment variable:
${KICAD8_3DMODEL_DIR} - Project relative:
${KIPRJMOD}/3d_models/
Export Formats
Manufacturing Outputs
Gerber (RS-274X)
Extension:.gbr, .gtl, .gbl, etc.
Layers:
.gtl- Top copper (F.Cu).gbl- Bottom copper (B.Cu).gto- Top silkscreen (F.SilkS).gbo- Bottom silkscreen (B.SilkS).gts- Top solder mask (F.Mask).gbs- Bottom solder mask (B.Mask).gm1- Board outline (Edge.Cuts)
- Excellon format (
.drl) - Separate PTH/NPTH or merged
Pick-and-Place
Extension:.pos
Format: CSV
Bill of Materials (BOM)
Extension:.csv, .xml
Formats:
- CSV - Simple tabular
- XML - Structured data
- Custom via BOM plugins
Documentation
- Vector graphics
- Embedded fonts
- Color/monochrome
- Layer selection
SVG
Purpose: Web-friendly vector graphics Use cases:- Documentation websites
- Interactive viewers
- Editing in vector tools
CAD Exchange
DXF (Drawing Exchange Format)
Purpose: Mechanical CAD integration Exported data:- Board outline
- Component outlines
- Mounting holes
- Keepout zones
STEP (.step)
Purpose: 3D mechanical model
Content:
- Board substrate
- Component 3D models
- Accurate positioning
- Assembly validation
IDF (Intermediate Data Format)
Purpose: MCAD ↔ ECAD exchange Files:.emn- Board outline and components.emp- Component library
File Format Versioning
Version Field
All KiCad files include version number:Compatibility
Forward compatibility: Newer KiCad versions can open older files Backward compatibility: Limited - older versions may not understand new features Migration: Automatic format upgrade on saveVersion History
- 20250610: KiCad 9.0 development
- 20231231: KiCad 8.0 release
- 20230620: KiCad 7.0 release
- 20211014: KiCad 6.0 release
- 20200825: KiCad 5.99 (development)
File Encoding
Character encoding: UTF-8 (mandatory) Line endings:- Unix: LF (
\n) - Windows: CRLF (
\r\n) - normalized to LF - macOS: LF (
\n)
File Compression
Native files are not compressed to ensure:- Version control efficiency (meaningful diffs)
- Text editor compatibility
- Debugging capability
- Cross-platform portability
See Also
- Codebase Structure - Code organization
- Core Libraries - S-expression parser
- Plugin System - I/O plugins