What is a Gerber file?
Updated
A Gerber file is a description of one layer of a printed circuit board: the copper of the top side, the openings in the solder mask, the silkscreen text. A board is made from a set of them, one per layer, plus its drill files. It is the format almost every PCB fabricator asks for.
A vector image of one layer
The format describes a layer as a 2D image built from simple objects:
- Flashes: an aperture (a circle, rectangle, obround, polygon or custom macro shape) stamped at a point — a pad.
- Draws: an aperture dragged along a line or arc — a trace or a silkscreen stroke.
- Regions: filled outlines — copper pours and large pads.
Each object is dark (adds to the image) or clear (removes from what is already there), which is how a copper pour gets its clearances.
RS-274X, X2 and X3
RS-274X (extended Gerber) is the format in use today. Each file states its own coordinate format and units and defines its apertures, so it can be read on its own. The older RS-274-D left those out and needed a separate aperture list, which is why it is obsolete.
Gerber X2 adds attributes: the file says what it is (%TF.FileFunction,Copper,L1,Top*%) and its objects say what they are (a component pad, a via, a conductor). Gerber X3 adds component data — each part's designator, position and pins. Readers that do not know the attributes can ignore them, so X2 and X3 files open everywhere.
The files a two-layer board needs
- Top and bottom copper
- Top and bottom solder mask (the openings, drawn as a negative)
- Top and bottom silkscreen (legend), if the board has one
- Top and bottom paste, for a stencil
- The board outline (profile)
- Drill files for plated and non-plated holes
A four-layer board adds two inner copper layers, and so on. Many tools also write a Gerber job file (.gbrjob) listing the files, the stack-up, the thickness and the finish. Names vary by tool; see Gerber file extensions.
Coordinates and units
A Gerber file stores coordinates as integers with an implied decimal point. The format statement (%FSLAX46Y46*%) says how many integer and decimal digits there are, and the unit statement (%MOMM*% or %MOIN*%) the unit. Read either wrongly and every coordinate is off by a power of ten or by 25.4 — the reason a careful viewer converts them once, exactly, when it reads them.
View one now
Open the sample board to see a full set of Gerber, drill, job and placement files drawn in 3D, or open your own.
Questions
How do I open a Gerber file?
With a Gerber viewer. Gerber3D opens them in the browser, free and without uploading them: choose the board's files or its ZIP and it shows every layer in 2D and the whole board in 3D.
Is a Gerber file the same as a PCB design file?
No. A design file (a KiCad .kicad_pcb, an Altium .PcbDoc, an Eagle .brd) holds the whole design: parts, nets, rules. Gerber files are what the design tool exports for manufacturing: the image of each layer, with no nets or parts unless X2 or X3 attributes add them.
What is the difference between RS-274X and Gerber X2?
RS-274X is the extended Gerber format: each file carries its own format statement and aperture definitions. Gerber X2 is RS-274X plus attributes that say what the file is (top copper, soldermask) and what its objects are (pads, vias, conductors). Gerber X3 adds component attributes.
Do I need the drill files too?
Yes. Holes are not in the Gerber layers but in separate drill files, usually in the Excellon format. A fabricator needs both.