Generate Gerber file from Kicad

Posted by


Kicad is an open-source electronic design automation (EDA) software used for printed circuit board (PCB) design. It allows designers to create schematics, route wires on circuit boards, and generate manufacturing files.

One of the most important manufacturing outputs from Kicad is the Gerber file. Gerber is a file format used by PCB manufacturers for production. It contains vector image data of the copper layers, solder mask, silkscreen, drill holes, etc. Each layer of the PCB layout needs to be exported separately into a Gerber file.

This article will provide a step-by-step guide on generating Gerber files from a Kicad project. We will cover:

  • The basics of Gerber format
  • Configuring Kicad for Gerber file generation
  • Exporting Gerber and drill files
  • Performing design rule checks
  • Common errors and troubleshooting

Follow these steps correctly to generate error-free Gerber files for your PCB manufacture.

What is Gerber Format?

Gerber format, also known as RS-274X, is the industry standard for PCB layout data transfer. It uses 2D vector graphics to represent PCB layers in a simple text-based format.

Gerber files can only contain a single layer’s data unlike native EDA files which may have the entire board layout. Hence, each copper layer (Top, Bottom etc.), solder mask, silkscreen, drill data etc. must be exported as separate Gerber files.

Some key properties of Gerber format:

  • Vector graphics based – Uses lines, arcs, polygons etc. to represent PCB features.
  • Text mode – File consists of simple ASCII coordinate and command data.
  • 2D layout – No 3D construction data like board thickness.
  • Colorless – No color information like solder mask color.
  • Excellent precision – Coordinates specified up to 6 decimal places.
  • Widely adopted – Accepted by majority of PCB manufacturers.

By combining the right Gerber files, manufacturers can reconstruct the entire PCB design. The format offers excellent precision down to microns, capable of producing high-quality boards.

However, the simplicity of Gerber format also means any errors in files can cause problems in fabrication. So files must be carefully validated before sending to manufacture.

Configuring Kicad for Gerber Export

Before generating the Gerber files, we need to configure the correct manufacturing settings in KiCad:

Enable Fine Line Mode

  • Go to Preferences > Configure Paths > GerbView.
  • Check the option Use Protel filename extensions. This enables the .gbr extension and fine line mode for better Gerber precision.

Set Default Plot Options

  • Go to Preferences > Configure Paths > Pcbnew.
  • Under Default Plot Options, set the correct Units (Millimeters or Inches) and Width for line drawings.
  • Ensure the Use Gerber extensions option is enabled here as well.

Review Net Classes

  • Net classes allow grouping tracks based on their PCB requirements like trace width, clearance etc.
  • Go to Design > Net Classes and review the net classes in your PCB.
  • Ensure the track width and clearance values match your PCB requirements for fabrication.

Review Design Rules

  • Design rules specify the manufacturing tolerances to validate the design against.
  • Go to Design > Rules and ensure the rules match your board house specs.
  • Pay special attention to the minimum clearance, track width, via and hole sizes.

Exporting Gerber Files

Once the basic settings are configured, we can start generating the Gerber files. Each layer of the board requires a separate Gerber file.

The typical output layers from Kicad are:

  • Copper Layers – Top, Bottom etc. All signal routing is contained in the copper layers.
  • Solder Mask Layers – Top and Bottom solder mask which prevent solder from bridging signals.
  • Silkscreen Layers – Top and Bottom silkscreen provide component outlines, text and other graphics.
  • Drill Drawings – NC drill files containing hole sizes and locations.
  • Drill Maps – Excellon drill maps mapping hole sizes to tool numbers.

Let’s go through the exporting process for each layer below:

Copper Layers

The copper layers contain the actual PCB routing and pad geometries. This data is most crucial for manufacturing the board successfully.

To export copper layers:

  1. Open File > Plot.
  2. Under Plot Options, set the layer as the copper layer you wish to plot (F.Cu, B.Cu etc).
  3. Enable the Plot to Gerber option.
  4. Set output directory and click Plot.
  5. Repeat for all copper layers separately.

The generated Gerber file will contain just the copper geometry data for that layer.

Solder Mask Layers

The solder mask is the protective green layer over the bare copper of the PCB. It prevents solder bridges and also provides branding text.

To export the solder mask:

  1. Open File > Plot and set F.SolderMask or B.SolderMask as the layer.
  2. Enable Plot to Gerber.
  3. Important: Set the Mirror option for bottom solder mask. Keep it unchecked for top solder mask.
  4. Set output filename and export.
  5. Repeat for both top and bottom solder masks.

The mirroring ensures the text and openings come out correctly aligned on both sides.

Silkscreen Layers

The silkscreen provides component outlines, text and other graphics printed on the board.

To export silkscreen:

  1. Open File > Plot and set F.Silkscreen or B.SilkSreen as the layer.
  2. Enable Plot to Gerber and set output file.
  3. Just like solder masks, set Mirror option correctly for top vs bottom silkscreen.
  4. Plot files for both layers.

Drill Drawings

The drill drawings indicate the locations and sizes of all holes to be drilled on the board.

To export drill drawing:

  1. Open File > Plot.
  2. Under Drill and Place Files, enable the Gerber Files option.
  3. Set output folder and filename.
  4. Click Plot to generate the NC drill file.

Drill Map

The Excellon drill map contains a mapping of drill bit sizes to tool numbers.

To generate drill map:

  1. Follow same steps as drill drawing above.
  2. In Drill and Place Files, enable the Excellon Files option instead.
  3. Set output filename and click Plot.

This completes the generation of all required Gerber files from Kicad!

Design Rule Check (DRC)

Before sending the Gerber files for manufacturing, it is critical to validate them against the design rules and constraints. Even the smallest violations can lead to short circuits or broken traces on the manufactured board.

To run DRC:

  1. Open Tools > Design Rule Check.
  2. Select which layers to validate under Layers to validate.
  3. Enable Test for all enabled design rules and any other checks required.
  4. Click Run DRC and review errors.
  5. Repeat validation after correcting any errors.

The design rules set during configuration will be used for violations. Pay special attention to any “Need hotspot” errors which indicate clearance problems.

It is good practice to correct all DRC errors before generating new Gerber files for manufacturing.

Troubleshooting Gerber Generation

Here are some common errors and troubleshooting tips for Gerber file generation:

Layers plotted incorrectly

  • Ensure top vs bottom layers have Mirror option set correctly during export.

Text backwards on one side

  • Mirror was not enabled. Re-export that solder mask/silk layer with mirror.

Error messages from manufacturer

  • Run full design rule check and correct any violations before re-exporting files.

Files rejected by manufacturer

  • Open Gerber files in GerbView and check for any stray geometry or issues visually.
  • Ensure all required layers were generated – copper, masks, silk, drill.

Board is oversized

  • Check units configuration in default Pcbnew plot options.

Features appear misaligned

  • Fine line mode may not be enabled. Check GerbView preferences.

Clearance violations on board

  • Review your net classes, design rules and rerun DRC. Update rules if required.

Copper features missing on board

  • Ensure the layer was exported on the correct side – Top vs Bottom.

With attention to detail during file generation and validation using DRC, you can create manufacturing-ready Gerber files from Kicad successfully.


What is the difference between Gerber and Excellon formats?

Gerber contains 2D vector image data for PCB layers. Excellon files contain only NC drill hole locations and sizes.

Can I combine multiple PCB layers in one Gerber file?

No, Gerber format allows only one layer per file. So each copper, mask, silk must be exported separately.

What are the most common Gerber file errors?

Clearance violations, incorrect text mirroring, missing layers and stray geometry are some of the most common issues.

How accurate is Gerber format compared to native KiCad files?

Gerber can provide precision down to six decimals when used in fine line mode. So it offers excellent accuracy.

Do I need to generate Gerber files if I order from a prototyping service?

Most prototyping services accept native KiCad PCB files directly without needing Gerber. But for final manufacture at a PCB fab, Gerber is required.


Creating manufacturing-ready Gerber files from KiCad involves careful configuration, plotting each layer individually, and extensive validation using DRC. With the right files containing accurate PCB data, you can produce professional-quality printed circuit boards from KiCad layouts. The provided guide covers the complete step-by-step process to generate error-free Gerber files for fabrication.