cuprio

What are Gerber files?

Gerber files are the standard way to send a PCB design to a manufacturer. Each file is a 2D vector image of one layer of the board: a copper layer, the solder mask, the silkscreen legend, the solder paste or the board outline. Holes travel separately in drill files, usually in Excellon format. The fab builds the board from these files, not from your CAD project, so what the Gerbers show is what you get.

  • 2 min read
  • 4 sections
  • 4 sources

What is inside a Gerber file?

The format is maintained by Ucamco, whose specification describes it as an open vector format for 2D binary images: every point is either covered or not. It is a plain text file with just 27 commands that define apertures (the shapes used to draw), draws, arcs, flashed pads and filled regions. The rule is one file, one image: a single Gerber file holds exactly one layer, and splitting one layer into several positive and negative files is invalid in modern Gerber.

Each file declares its unit once in the header. The specification recommends millimeters and calls inch units historic, to be deprecated in future. Ucamco revises the specification regularly; the downloads page lists the current revision.

Which files does a PCB fab need?

For a two-layer board, JLCPCB's KiCad guide asks for top and bottom copper (F.Cu, B.Cu), solder mask (F.Mask, B.Mask), silkscreen (F.Silkscreen, B.Silkscreen), paste (F.Paste, B.Paste) and the board outline (Edge.Cuts), plus the inner copper layers (In1.Cu, In2.Cu and so on) on four- and six-layer boards. Drill files list the plated and non-plated holes; the same guide sets drill units to millimeters, uses the alternate drill mode for oval holes, and recommends a drill map. Zip the folder and upload it.

Useful plot options in KiCad are subtracting solder mask from silkscreen, so no legend lands on pads, and checking zone fills before plotting, so copper pours are current.

What do Gerber X2 and X3 add?

A Gerber file without attributes is called X1 and describes only shapes; the much older Standard Gerber (RS-274-D), which relied on a separate aperture list, is revoked. Gerber X2 adds attributes, labels that do not change the image but tell the fab what it is looking at. The most important is .FileFunction, which states the role of each file, for example %TF.FileFunction,Copper,L1,Top*% for the top copper layer. Aperture attributes mark a pad as an SMD pad, via pad, castellated pad or fiducial, and net attributes carry the CAD netlist so the fab can compare connectivity with the image.

Gerber X3 extends this to assembly with component data: reference designator, position, rotation, footprint and part numbers. KiCad can write its pick-and-place file in Gerber X3 format as an alternative to CSV. A Gerber job file can also describe the overall build, such as board thickness and finish, in a machine-readable form.

How do you check Gerber files before ordering?

  1. Open them in a viewer

    Ucamco's reference viewer shows X1 and X2 Gerbers, Excellon and XNC drill files and IPC-D-356 netlists; most fabs also show a render after upload.

  2. Count the layers

    Every copper layer, both masks, both legends and the outline should be present and named for the right side.

  3. Check alignment

    Drill hits should sit in the center of their pads on every layer.

  4. Look at the masks and legend

    Mask openings should cover every pad, and no silkscreen should sit on copper that will be soldered.

  5. Confirm the outline

    The board edge must be one closed shape, with cutouts and slots where you expect them.

Sources

  1. Ucamco: The Gerber Layer Format Specification (downloads page)

    Gerber as an open 2D binary vector format, 27 commands, one file one image, metric recommended, X2 attributes, .FileFunction example, fiducial and castellated pad functions, component data, reference viewer

    ucamco.com
  2. Ucamco: Gerber format

    Gerber job file, attributes, X2 and X3 overview

    ucamco.com
  3. JLCPCB: How to generate Gerber and drill files in KiCad 8

    Layers to plot, plot options, drill settings and zip upload

    jlcpcb.com
  4. KiCad 9.0 documentation: PCB Editor

    Placement file in Gerber X3 format, fabrication output formats

    docs.kicad.org
Close view of the two-wheel robot controller, a board designed in Cuprio

Be first in when we open.

Start with 600 welcome credits and get 30% off your first 12 months.