Skip to main content
KiCad can generate all files required for PCB manufacturing and assembly, including Gerber files, drill files, pick-and-place data, and bill of materials. The export system ensures your design can be accurately reproduced by fabrication houses.

Overview

Manufacturing output is handled by various exporter classes in KiCad. The most important are Gerber generation (source/pcbnew/exporters/gerber_jobfile_writer.h), drill file generation, and assembly file creation.

Gerber Files

What are Gerber Files?

Gerber files are the industry standard format for PCB manufacturing. Each file represents one layer of the PCB:

Copper Layers

Front, back, and internal copper patterns

Solder Mask

Protective coating over copper

Silkscreen

Component designators and markings

Paste Stencil

Solder paste application pattern

Generating Gerber Files

1

Open Plot Dialog

In Pcbnew: File → Fabrication Outputs → Gerbers (.gbr)
2

Select Layers

Choose which layers to export:Standard 2-layer board:
  • F.Cu (front copper)
  • B.Cu (back copper)
  • F.SilkS (front silkscreen)
  • B.SilkS (back silkscreen)
  • F.Mask (front solder mask)
  • B.Mask (back solder mask)
  • F.Paste (front solder paste, SMD only)
  • B.Paste (back solder paste, SMD only)
  • Edge.Cuts (board outline)
Multi-layer board: Add all internal copper layers (In1.Cu, In2.Cu, etc.)
3

Configure Options

Set Gerber parameters:
// Plot format: Gerber (RS-274X)
bool plotBorderAndTitle = false;      // Exclude title block
bool plotFootprintValues = true;      // Include component values  
bool plotFootprintReferences = true;  // Include reference designators
bool plotInvisibleText = false;       // Exclude hidden text
bool subtractMaskFromSilk = true;     // Clip silkscreen from pads
Coordinate format: 4.6 (millimeters) or 4.5 (recommended)Aperture macros: Use for complex pad shapes
4

Generate Files

Click Plot to create Gerber files.Output files:
project-F_Cu.gbr
project-B_Cu.gbr  
project-F_SilkS.gbr
project-B_SilkS.gbr
project-F_Mask.gbr
project-B_Mask.gbr
project-Edge_Cuts.gbr
5

Generate Gerber Job File

Create a Gerber job file (JSON format) describing the fabrication:
// Source: pcbnew/exporters/gerber_jobfile_writer.h:71
class GERBER_JOBFILE_WRITER
{
    bool CreateJobFile( const wxString& aFullFilename );
};
The job file includes:
  • List of Gerber files and their layer assignments
  • Board dimensions
  • Layer stackup (copper/dielectric thickness)
  • Material specifications
  • Manufacturing notes

Gerber File Structure

Gerber files use RS-274X format:
G04 KiCad Gerber File*
G04 Created by Pcbnew*
%FSLAX46Y46*%
%MOMM*%
%TF.FileFunction,Copper,L1,Top*%
%TF.FilePolarity,Positive*%
%ADD10C,0.200000*%
D10*
X100000Y100000D03*
M02*

Drill Files

NC Drill Files

Generate drill files for through-holes and vias:
1

Open Drill File Dialog

File → Fabrication Outputs → Drill Files (.drl)
2

Select Format

Choose drill file format:
Most common format (NC Drill)
// Source: pcbnew/exporters/gendrill_excellon_writer.h
class EXCELLON_WRITER : public GENDRILL_WRITER_BASE
{
    void CreateDrillandMapFilesSet( const wxString& aPlotDirectory,
                                   bool aGenDrill, bool aGenMap );
};
Settings:
  • Units: Millimeters (recommended) or inches
  • Zeros: Decimal format (3.3) or suppress leading/trailing
  • Precision: 3:3 (mm) or 2:4 (inch)
3

Configure Drill Options

Set drill parameters:
  • PTH and NPTH in single file: Combine all holes
  • Separate files: PTH drills separate from NPTH
  • Merge PTH and NPTH: All holes together (not recommended)
  • Drill origin: Absolute or auxiliary axis
4

Generate Drill Map

Create visual drill map (PDF or Gerber) for reference.Shows:
  • Drill hole positions
  • Tool numbers and sizes
  • Layer information
5

Generate Files

Output files:
project-PTH.drl         # Plated through-holes
project-NPTH.drl        # Non-plated holes  
project-PTH-drl_map.pdf # Drill map

Drill File Structure

Excellon format example:
M48
; DRILL file {KiCad 8.0} date 2024-01-15
; FORMAT={-:-/ absolute / metric / decimal}
FMAT,2
METRIC
T1C0.300
T2C0.800
T3C1.000
%
G90
G05
T1
X100.0Y100.0
X120.0Y100.0
T2
X100.0Y150.0
M30

Assembly Files

Pick-and-Place (PnP)

Generate component position files for automated assembly:
1

Export Position File

File → Fabrication Outputs → Component Placement (.pos)
2

Select Format

Choose file format:
  • ASCII (CSV): Human-readable, most compatible
  • Gerber X3: Modern format with full metadata
3

Configure Options

Set position file parameters:
// Units: mm or inches
// Format: CSV (comma-separated values)
// Include columns:
// - Reference (R1, C1, U1)
// - Value (10k, 100nF, STM32)
// - Package (0805, SOIC-8)
// - X, Y position
// - Rotation (degrees)
// - Layer (top/bottom)
4

Filter Components

Options:
  • Include only SMD: Exclude through-hole parts
  • Include only with SMD attribute: Use footprint attributes
  • Exclude from pos files: Honor footprint flag
  • Exclude DNP: Skip Do Not Populate components

PnP File Format

CSV format example:
Ref,Val,Package,PosX,PosY,Rot,Side
R1,10k,R_0805_2012Metric,25.4,50.8,0,top
C1,100nF,C_0805_2012Metric,30.5,50.8,90,top  
U1,STM32F103,LQFP-48_7x7mm_P0.5mm,50.0,75.0,0,top

Gerber X3 Pick-and-Place

Modern format with component metadata:
%TF.FileFunction,Component,Pick&Place,Top*%
%TF.GenerationSoftware,KiCad,Pcbnew,8.0*%
%TO.C,R1*%
%TO.CRot,0.000*%
%TO.CVal,10k*%
%TO.CPkg,R_0805_2012Metric*%
X25400000Y50800000D03*
%TD*%

Bill of Materials (BOM)

Generate BOM from Schematic

In Eeschema: Tools → Generate BOM
Simple component list:
  • Grouped by value
  • Shows reference designators
  • Includes quantities
  • Basic CSV or XML output

BOM Content

Typical BOM includes:
Reference
string
required
Component designator (R1, C5, U3)
Quantity
number
required
Number of identical components
Value
string
required
Component value or part number
Footprint
string
PCB package type
Datasheet
string
Link to component datasheet
Manufacturer
string
Component manufacturer
MPN
string
Manufacturer part number
Supplier
string
Where to purchase (Digi-Key, Mouser, etc.)
SPN
string
Supplier part number

Other Export Formats

IPC-2581

Modern PCB fabrication format:
// Source: pcbnew/pcb_io/ipc2581/
// Complete design transfer including:
// - Stackup definition
// - Board outline
// - Component placement  
// - Netlist
// - BOM

GenCAD

Legacy CAM format:
// Source: pcbnew/exporters/export_gencad.cpp
void Export_GenCAD( const wxString& aFullFileName, BOARD* aBoard );

Hyperlynx

Signal integrity simulation:
// Source: pcbnew/exporters/export_hyperlynx.cpp
// Exports for SI/PI analysis tools

IDF (Intermediate Data Format)

Mechanical CAD integration:
// Source: pcbnew/exporters/export_idf.cpp  
// Board outline and component heights for MCAD

Fabrication Package

Typical fabrication package includes:
fabrication/
├── gerbers/
│   ├── project-F_Cu.gbr
│   ├── project-B_Cu.gbr
│   ├── project-F_SilkS.gbr
│   ├── project-B_SilkS.gbr
│   ├── project-F_Mask.gbr
│   ├── project-B_Mask.gbr
│   ├── project-Edge_Cuts.gbr
│   └── project-job.gbrjob
├── drill/
│   ├── project-PTH.drl
│   ├── project-NPTH.drl
│   └── project-drl_map.pdf
├── assembly/
│   ├── project-top-pos.csv
│   ├── project-bottom-pos.csv
│   ├── bom.csv
│   └── assembly_drawing.pdf
└── mechanical/
    ├── project.step
    └── board_outline.dxf
Zip all files together and send to your PCB manufacturer. Most accept Gerber + Excellon drill files.

Manufacturing Notes

Include fabrication notes with your order:

Board Specifications

  • Material: FR4, aluminum, flexible, etc.
  • Thickness: 1.6mm (standard), 0.8mm, 2.0mm, etc.
  • Copper weight: 1oz (35µm), 2oz, etc.
  • Layers: 2, 4, 6, 8, etc.
  • Finish: HASL, ENIG, OSP, etc.
  • Color: Green, blue, red, black, white mask
  • Min trace/space: Based on design rules
  • Min drill: Smallest hole size used

Special Requirements

  • Controlled impedance traces
  • Blind/buried vias
  • Edge plating
  • Chamfered edges
  • Gold fingers (edge connectors)
  • Specific markings or serialization

Validation Before Manufacturing

1

Run DRC

Ensure all design rule violations are resolved.
2

Verify Gerbers

Use Gerber viewer (GerbView in KiCad) to inspect all layers:
  • Check copper patterns
  • Verify silkscreen placement
  • Confirm solder mask openings
  • Inspect board outline
3

Check Drill Files

Review drill map:
  • Verify hole sizes
  • Check PTH vs NPTH
  • Confirm via locations
4

Review Assembly Data

Validate pick-and-place:
  • Component positions correct
  • Rotations accurate
  • No missing components
  • DNP flags set properly
5

3D Check

Use 3D viewer to verify:
  • Component heights
  • Mechanical clearances
  • Connector orientations
  • Mounting hole positions

Best Practices

Stick to Gerber RS-274X and Excellon drill files for maximum compatibility with manufacturers.
Always generate a Gerber job file. It helps manufacturers understand your design intent.
Verify your manufacturer’s requirements before generating files. Some have specific layer naming or format preferences.
Keep complete fabrication packages with design files. Include date and revision in filenames.
Order a small quantity initially to verify the design before full production.

Source Code References

// Gerber job file generation
// Location: source/pcbnew/exporters/gerber_jobfile_writer.h:71  
class GERBER_JOBFILE_WRITER

Next Steps

Design Rules

Configure constraints for manufacturability

PCB Layout

Design boards for manufacturing

3D Models

Export 3D for mechanical integration

Build docs developers (and LLMs) love