Support Team
Feedback:
support@nextpcb.comYour PCB design looks perfect in KiCad; you’ve gone through all the ERC and DRC warnings, double-checked every pin and you’re ready to get these printed circuit boards printed, but what’s that? The manufacturer is asking for Gerber files? What’s a Gerber file? Why can’t you just hand them the KiCad design? Why are there so many settings? What will happen if you get one of these wrong? Is it Gerber as in Gerbil? Or Gerber as in Gertrude?
This article will cover how to generate Gerber files in KiCad, answer all the questions above and more; including common pitfalls and tips to get your PCBs manufactured right the first time.
If you just need a quick template to copy the settings, refer to our quick Geber guide here.
Gerber files (pronounced with a hard G) are the de facto industry standard file format for transferring PCB manufacturing data. If someone wants to get a PCB board fabricated, more likely than not, they need to export Gerber files from whatever tool they are using. Be it KiCad, Eagle, Altium or Target9001, just about every modern EDA tool supports Gerber file export natively, even if it is deliberately restricted or behind a paywall.
If a manufacturer supports native KiCad files, it is likely that they are just taking care of the Gerber export for you, which helps reduce errors.
Other file formats exist, such as IPC2581, but EDA tool support is limited, and not all PCB fabricators accept it. If in doubt, go Gerber.
But hold on, even Gerber files have different formats.
RS-274X Gerber: You will most likely hear about Gerber files in RS-274X format (otherwise known as X1 or Extended Gerber), which is the most commonly accepted.
X2 and X3 Gerber: Newer X2 and X3 formats have more information appended, such as stack-up and component placement. However, this information may not be utilized by the manufacturer and may have compatibility issues with older software.
RS-274D Gerber: RS-274D is the predecessor to RS-274X and is now almost obsolete. This format is highly prone to errors and compatibility issues.
If in doubt, check with your manufacturer or export in RS-274X format.
Manufacturers and designers alike will refer to PCB production data as “Gerber files” or just “Gerbers.” In reality, they are referring to Gerber files + drill files + any other production documentation, such as stack-up and impedance control information.
Likewise, a single PCB design is represented by several individual Gerber files, not ‘a single Gerber file,’ depending on the number of layers and sides. In KiCad, each KiCad layer translates to a Gerber file when exported. Manufacturers, especially those with online ordering systems, often ask for all the PCB production data to be packaged into an archive file e.g. .zip or .rar for easy handling.
For more detailed information on the individual Gerber layers and the information they contain, you can read our 3-part article series on All About Circuits here.
Don’t forget the drill file!
The drill file is technically not in Gerber format, but it is just as important. In KiCad, the drill file export process is another step separate from Gerber generation, which can make it easy to forget. Worst case scenario, your board gets manufactured without any drill holes!
The basic Gerber export process itself is very simple. Once you have the configuration settings for your manufacturer set up, it only takes 4 clicks to export the PCB Gerber files and drill files:
In KiCad:
Now your Gerber and drill files have been exported to the output directory.
That was easy, right? However, knowing how to set up the configuration to suit your design and supplier is another problem altogether, and can be daunting for the beginner.
Let’s go into each option in detail:
Plot Format: The default is Gerber format, but KiCad supports plotting to many other formats including SVG, Postscript, DXF, even PDF for outlines and importing into other software. For production, we will need the Gerber files.
Output Directory: This is the directory where KiCad will dump the exported Gerber files. The default value is the original directory in a new folder called Gerbers. You can open the output directory directly by clicking the button on the right.
Include Layers: This section allows you to select the KiCad layers to export as Gerber files. Not all of these are necessary for production and the layer names in the screenshot may differ to your design and KiCad version, but generally the following layers are needed for a double-sided design:
The paste layers are required for surface mount designs if you intend to make a PCB stencil for assembly. Even if you don’t need stencils, including them does not hurt.
For multilayer designs, be sure to select the inner copper layers. If you have vital information you need to pass on to manufacturers in any of the other layers, be sure to export these as well.
Plot on All Layers: This section allows you to copy the contents of a layer to all other layers. For example, you may want to copy the board outline in the Edge.Cuts layer to the other layers for alignment. Be careful with this however. Accidentally copying silkscreen or traces to all your layers could completely ruin the other Gerber files and cause short circuits.
General Options:
The General Options apply to outputs such as PDF fabrication drawings that are used for assembly. The only relevant option is the Check zone fills before plotting. Check this box unless you have custom zone fills you need to preserve.
Use Protel filename extensions: This adds the standard .GTL, .GBL, .GTO, .GBO file extensions to your exported Gerber files rather than the official .gbr extension. The original filename and file format does not change. While the pop-up says this is no longer recommended, some automated Gerber file readers (think Gerber Viewers) use this to identify and auto-assign the layer. Humans generally have no problems identifying the layer, but personally I think it does not hurt to have this additional label.
Generate Gerber job file: This is a non-production file that logs the files exported. It is not necessary, but can add some insights into the design, such as the version of KiCad used - useful when investigating issues.
Subtract soldermask from silkscreen: This option removes sections of silkscreen where there are solder mask openings (areas with no solder mask). This is typically to prevent silkscreen from being printed onto copper pads and interfering with soldering - however, most fab houses already do this subtraction when processing your files. You can use this option if you’d like to preview the result of subtraction or if you know the manufacturer does not offer this service.
Coordinate format: KiCad only offers two coordinate formats (other EDA tools have more customization), and either one will likely not affect your boards in any way. The only difference is the number of digits after the decimal point, which indicates precision, where 6 decimals is more precise than 5. For high-speed and RF designs, submicron tolerances may be affected by rounding and could benefit from the higher precision.
Lower precision could be favorable for larger file sizes, where precision is not important, such as for PCB art. The large file size could potentially crash CAD tools.
For this PCB ruler with moderate graphical elements, the package does reduce in size, but only by about half an MB
Use extended X2 format (recommended): Check this feature to add X2 header information to the Gerber files, effectively changing the Gerber format from RS-274X to X2. It is recommended, however be aware that some older manufacturers do not accept X2 format.
Include netlist attributes: This adds netlist like attributes to the Gerber files that can be used by some CAD tools.
Disable aperture macros (not recommended): Aperture macros offer advantages in terms of support for complex geometric shapes and reducing file size. However, like the X2 format, the addition of aperture macros can cause compatibility issues with older software. These errors can be difficult to catch, as they are limited to these specific apertures: a hexagonal pad or thermal, for example.
Clicking the Generate Drill Files button will bring you to the drill file export interface. Simply click the Generate button to plot the drill file in the output folder.
Format: Drill files are often requested in Excellon format rather than Gerber, though KiCad supports X2 Gerber export as well.
PTH and NPTH in single file: The pop-up says this is not recommended, but manufacturer preferences vary. In practice, many accept both merged and separate options. The advantage of having them merged is that you are less likely to leave one out and end up with missing holes.
Options: KiCad offers much more format customization for drill files
Generate Drill Map: KiCad provides the option to export the drill map. This is a Gerber layer that provides location and size information graphically rather than literally. Unlike Excellon drill files, drill maps can contain extra information such as the nature of the drill holes, the quantity and size in written word. However, Excellon drill format files are more widely accepted compared to drill maps, and typically a manufacturer that can handle drill maps will also accept Excelllon drill files, but manufacturers that ask for Excellon drill files will not necessarily accept drill maps, as it may require additional manual input.
Compare drill maps to Excellon drill files on the right:
The above suggestions are generic and should apply to the large majority of PCB fab houses. However, some have individual preferences that work best for their software and equipment. Always follow the manufacturer’s recommended guidelines first.
Still don’t know that works best for your design and fab? Thanks to KiCad’s open-source nature, support for KiCad files is widely available. Some manufacturers accept native KiCad files or have tools for exporting the files to their recommendations, so you can skip the Gerber file export nonsense altogether.
Numerous manufacturers have developed their own KiCad plugins to support Gerber export and even send the output files to their website directly. The settings are pre-configured to their preferences for optimal compatibility.
Manufacturers with native KiCad file support take .kicad_pcb files directly and take care of Gerber export.
NextPCB has a mixed approach, with KiCad plugins and a direct Gerber export service.
Before you go to production, make sure you check these important things off your list!
Understand your chosen manufacturer’s requirements: Check the website for information regarding their manufacturing capabilities, accepted files and other services. They may have specific guides for exporting Gerber files from KiCad, KiCad plugins or direct KiCad file support.
Check your Gerber files!: When you export Gerbers from KiCad, your design is being translated from KiCad’s native format into the standardized Gerber/Excellon formats used by PCB manufacturers. Like any translation, errors can and do occur. Missing layers, traces, solder mask openings -- these mistakes are costly if left undiscovered but are easily discovered in a Gerber Viewer. KiCad has a simple Gerber Viewer tool built-in so there are no excuses. Don’t let all your hard work go to waste.
Perform DFM Analysis on the Gerber Files: Going a step further, you can perform Design for Manufacture and Assembly analysis (DFMA) on the PCB Gerber files with specialist tools such as HQDFM by NextPCB. HQDFM is a free PCB design analysis tool with DFM and DFA analysis capabilities that checks over 1200 detailed inspection items that go beyond DRC checks to reduce manufacturing errors, improve reliability and reduce costs. HQDFM also serves as an advanced Gerber viewer with helpful production tools including a Gerber panelizer, impedance calculator, footprint checker and more.
Double, triple check your footprints and Bill of Materials: Now that you have the PCB design covered, be sure to check the assembly documentation:
HQDFM has free tools for automating these tedious actions, including a footprint checker covering over 6 million parts and a BOM file checker.
Check your design in KiCad’s 3D viewer: Make use of KiCad’s 3D viewer during the design phase. It updates in real-time, so you can get immediate feedback as you complete your design. For Gerber files, HQDFM has a realistic viewer and 3D viewer as well.
How to convert Altium Designer files to KiCad and vice versa
How to import Altium Libraries into KiCad (without external tools!)
How to design your own custom PCB Ruler in KiCad
NextPCB provides PCB manufacturing and assembly services, focusing on reliability without breaking the bank. With 5 factories in China and over a decade of quick turnaround electronics manufacturing from prototype to mass production, NextPCB serves over 160 countries around the world, pairing dependable electronics hardware with exceptional service.
As a Platinum sponsor of KiCad and host of KiCon Asia, the only KiCad conference in the East, NextPCB is committed to supporting the KiCad development team and it’s vibrant community with development resources, manufacturing support, organizing events and amplifying awareness to make innovation accessible to everyone. Download Kicad here.
Still, need help? Contact Us: support@nextpcb.com
Need a PCB or PCBA quote? Quote now