Industry Article

Getting To Know the Gerber File Format and File Names

January 18, 2024 by Carmen Zheng, NextPCB

Learn the details of the Gerber file format for PCB layout, including function, common layers, file names, extensions, and revisions to the Gerber standards.

So you’ve finished your printed circuit board design and are getting ready to send it off to fabrication. The fab house asks for Gerber files of the design, and you’ve figured out how to export them from your EDA package. But what are Gerber files, actually? What if you didn’t export them correctly? How can you check them?

Even if your circuit board design passes all the Design Rule Checks and is perfect in the EDA tool, there is no guarantee that this is what you will get from the manufacturer. Is it the manufacturer’s fault? Probably not. Many things can go wrong with the black box that is Gerber files, and blindly sending them off to the manufacturer is asking for trouble.

In this three-part article series, we will:

  1. Explain the Gerber file format, file names, and standards revisions.
  2. Help you understand the Gerber layers used for PCB and stencil manufacturing.
  3. Explain the importance of Design for Manufacturing (DFM) Gerber checks and introduce free resources.

Through this series, we will demonstrate why it is important to check your Gerber file before sending it to the PCB manufacturer, help you identify and avoid common problems, and describe Gerber file checks that you should be performing.

 

What Are Gerber Files?

Gerber files are the de facto standard for transferring PCB data for manufacturing. These files contain all the data required to produce the films that go into printing all the layers of a circuit board. Gerber files use a binary vector format containing coordinates and basic line-by-line instructions to literally draw out the layers of the PCB.

 

The History of Gerber Files

Joseph Gerber developed the format and terminology. Gerber and his company, Gerber Scientific Instrument, developed many photoplotter systems for controlling a narrow light source to expose areas on the film (Figure 1).


Image from a Joseph Gerber patent for a scanning device for exposing a photosensitive surface

Figure 1. Image from a Joseph Gerber patent for a scanning device for exposing a photosensitive surface. Image used courtesy of Google Patents

 

Today, the Gerber file format continues to be updated and maintained by Ucamco. Information on older versions and new releases can be found on their site.

 

Gerber Files Are ASCII Text Files

The format is intentionally kept simple and uses ASCII characters to keep it human-readable for easy debugging. As demonstrated in Figure 2, you can view Gerber files in a text editor.

 

 sample of a Gerber file exported from Autodesk Eagle

Figure 2. A sample of a Gerber file exported from Autodesk Eagle.

 

Four Basic Gerber Single-Layer Commands

While the machines have advanced, thinking of Joseph Gerber’s early photoplotters can help visualize what the commands in Gerber files mean. Figure 3 provides examples of the ASCII code on the left and descriptive comments on the right.

 

Description of Gerber coordinate data from Ucamco’s latest specification

Figure 3. Description of Gerber coordinate data from Ucamco’s latest specification.

 

In the example of Figure 3, you can see the long x-y coordinates are followed by a D0# command which instructs the photoplotter what to do:

  • D01: Move to x-y with the shutter open (draw).
  • D02: Move to x-y with the shutter closed (without drawing).
  • D03: Open and close the shutter (flash).

The large majority of the PCB is drawn using these three basic drawing commands. D01 is used to draw traces and text. D02 would move the table to a new position without drawing. D03 is used to make single prints of the aperture for pads or thermals, for example.

In Figure 3, there is a line that just says “D11*”. The line with just the letter ‘D’ letter followed by a number is the D-code which calls for a specific aperture. The size and shape of the aperture are defined in the header of the file. For example, D11 could be a circle, and D12 could be a square, oval, thermal, or other custom-defined shape.

Lines with just an X or Y indicate that only one coordinate value changes. This can be used to create chip pads for a chip where only the x coordinate might change. Such methods helped to keep the Gerber files small when photoplotters could only handle a few bytes of data. There is much more to the specification than the introduction above, but from this, we can see how Gerber files are instructions for drawing binary 2D graphical data.

 

What Gerber Files Are Required To Make a PCB?

Clearly, one layer is not enough to define all the copper, solder mask, silkscreen, and mechanical data required for a PCB, so a typical instruction set consists of multiple Gerber files, with each file representing a single layer in the PCB. Manufacturers process these layers separately according to what information they contain. When the layers are combined, they make the circuit board.

When we talk about PCB Gerber layers, we are not talking about the PCB stackup or the FR4 substrate. Rather, we are referring to the layers that require custom printing and processing. This includes circuit layers, solder mask layers, silkscreen layers, and mechanical layers that describe everything about the size and shape of the board, including inner cut-outs.

 

Gerber Layer Files Example for a Double-Sided, Two-Layer Board

For a double-sided, two-layer board, both the top and bottom sides will have three unique, patterned layers:

  1. Circuit
  2. Solder mask
  3. Silkscreen

So that’s a total of six files—three for the top side and three for the bottom side of the PCB. In addition, a mechanical or outline layer is typically required to show the outline of the PCB board and any cut-outs. Placing the board outline data in other layers could cause confusion, so placing it in a separate mechanical layer is always advised.

Finally, a drill file will also likely be required to drill holes for connecting the top layers to the bottom layers. Drill files are technically not Gerber files, but they are very similar. Coordinates mark the x-y positions of the drill hits, and tool sizes are defined in the file header.

Drill files are handled by NC (numerical control) machines, so you may hear them being called NC drill or Excellon NC drill files, and many EDA software packages export them in a separate step. When you hear people request “Gerber files,” 99% of the time they actually mean the Gerber and drill files, even though drill files are not Gerber.

Putting all this together for a typical two-layer board, we would need eight Gerber files with all the instructions to ‘print’ the PCB board (Figure 4). For multilayer boards, any additional circuit layers are defined in their own Gerber layers.

 

Gerber layers for a typical double-sided, two-layer PCB

Figure 4. Gerber layers for a typical double-sided, two-layer PCB.

 

EDA software may export other Gerber files, such as paste files for making stencils or files to communicate other data to the fabricator or assembly house, such as component outlines, installation notes, etc., but these are typically not necessary to produce the plain PCB board.

 

How To Identify and Name Gerber Files

To identify which file represents which layer, your EDA tool will label the files using the filename and/or the file extension. These are very important as they tell your manufacturer how to produce the PCB. An incorrectly labeled file can render the whole board useless. Luckily, most modern EDA tools follow self-explanatory naming conventions.

Table 1 provides the default naming conventions from six popular PCB EDA tools:

  • Protel
  • KiCad
  • Eagle
  • Altium Designer
  • PADS
  • Circuit Wizard

Our PCB design for creating these examples was named ‘mypcb’ which you can see in many of the Gerber file names in the table.

 

Table 1. Gerber filenames and extensions from popular EDA tools.
Gerber Layer Altium Designer Protel KiCad
Top copper mypcb_Copper_Signal_Top.gbr mypcb.GTL mypcb-F_Cu.gbr
Bottom copper mypcb_Copper_Signal_Bottom.gbr mypcb.GBL mypcb-B_Cu.gbr
Bottom solder mask mypcb_Profile.gbr mypcb.GBS mypcb-B_Mask.gbr
Bottom paste mypcb_Paste_Bot.gbr mypcb.GBP mypcb-B_Paste.gbr
Top Silkscreen mypcb_Paste_Bot.gbr mypcb.GTO T_Silkscreen.gbr
Drill mypcb-RoundHoles.TXT mypcb.TXT mypcb.drl
       
Gerber Layer Eagle Circuit Wizard PADS
Top copper copper_top.gbr mypcb.g2 art001.pho
Bottom copper copper_bottom.gbr mypcb.g1 art002.pho
Bottom solder mask soldermask_bottom.gbr mypcb.g3 sm002028.pho
Bottom paste solderpaste_bottom.gbr - smd002022.ph
Top silkscreen silkscreen_top.gbr mypcb.g5 sst0018.pho
Drill drill_1_16.xln mypcb.drl drl001.drl

 

Notice that some of the filenames and extensions are self-explanatory, but some not so much. Many contain the PCB file name, which can be helpful but can also get lengthy. Protel’s GT- and GB- file extensions are generally understood in the industry, but it requires that you have file extensions visible. The filenames output by PADS are a little confusing at first but are identifiable. Circuit Wizard’s extensions are not helpful at all and most likely will not be accepted by manufacturers.

You may think that the long labels with the layer name could not be any clearer, but if you are sending your Gerbers to overseas fabricators, they may not understand the language you are using (Figure 5).

 

Gerber file names in alternate languages

Figure 5. Could you guess which Gerber files these names represent?

 

In Japanese, for example, the term solder resist is used more than solder mask, and stencils are often called metal masks. If in doubt, stick to clear English.

If your file naming convention does not match your manufacturer’s, as long as the names are logical and clear, it will almost always be OK because the engineers have probably seen these naming formats hundreds of times. Life is too short to go re-naming 8 or more files every time you need to build a PCB!

 

Changing Gerber Filename Extensions

Note that despite the different file extensions, the format and contents of the files are still the same. So, if you find yourself having to change the extension for some reason (maybe you are using Circuit Wizard), don’t worry about a warning message similar to Figure 6.

 

Example warning message when changing a Gerber filename extension

Figure 6. Example warning message when changing a Gerber filename extension.

 

Likewise, changing the extension to the above abbreviations will not ‘convert’ your file into Gerber format.

 

Gerber File Format Variations

As we discussed previously, Gerber files are just text, but you may encounter the sub-formats RS-274D, RS-274x, and X2 (extended) format. Let’s review each of these.

 

Standard Gerber

RS-274D Standard Gerber has been revoked and is no longer considered a Gerber format. Files in this Standard Gerber format do not have aperture information in the header. They only have the coordinate data. So RS-274D files have to be opened with an aperture file (often with the extension .apr).

It is an outdated format so there tend to be many errors present. NEVER export in RS-274D if you have RS-274X or other more current export options available. Most up-to-date EDA tools no longer even have RS-274D as an option.

 

Gerber X1

Known as X1 Extended Gerber, the RS-274X format has aperture and coordinate data in one file. RS-274X files are perfectly usable and can cover 90+ design requirements. It is tried and tested and will have the least compatibility issues.

 

Gerber X2

X2 Extended Gerber adds additional board information to the header of the RS-274X files, as shown in Figure 7. This can be convenient if supported by board manufacturers. It does not change the actual data itself. It is also known as ‘Gerber with attributes.’ While it is supposed to be backward compatible, older software will not recognize the new commands and may not be able to read the file as a result.


The header of an X2 Gerber file with attributes highlighted.

Figure 7. The header of an X2 Gerber file with attributes highlighted.

 

Gerber X3

Released in 2020, Gerber X3 adds assembly information in the form of two additional component layers. By reusing many of the previous formats’ commands, it maintains backward compatibility with previous Gerber formats.

The basic coordinate and aperture shape and size data are the same in all these sub-formats, and for basic Gerber viewing. As long as your software can read your files, you usually do not have to worry about the nuances between them unless you are encountering specific problems. Just avoid RS-274D Standard Gerber at all costs.

 

Viewing Gerber Files and DFM Checks

Hopefully now you have a better understanding of Gerber files. In the next two installments of this article series, we will:

To help you with your Gerber file reviews and DFM checks, HQ NextPCB has created a free Gerber tool for engineers called HQDFM. The tool is based on real problems computer-aided manufacturing (CAM) engineers encounter on a daily basis. You can download the HQDFM desktop suite to check for over 20 different DFM problems and get actionable insights or try the online Gerber Viewer version to receive a free DFM report.

 

Featured image background used courtesy of Adobe

Industry Articles are a form of content that allows industry partners to share useful news, messages, and technology with All About Circuits readers in a way editorial content is not well suited to. All Industry Articles are subject to strict editorial guidelines with the intention of offering readers useful news, technical expertise, or stories. The viewpoints and opinions expressed in Industry Articles are those of the partner and not necessarily those of All About Circuits or its writers.