Back to Blog
PCB

Gerber and Excellon Files: What Your PCB Fab Actually Receives

11 min read
Exploded view of a two-layer printed circuit board separated into copper, solder mask, silkscreen and outline layers, each labelled with its Gerber file extension, with a drill layer labelled as an Excellon file

There is a quiet moment every hardware person remembers: you press Export, a folder of cryptic files appears (names like top_copper.gtl and drill.xln), and you upload them to a fab on the other side of the world with a card payment and a lot of hope. A week or two later a padded envelope arrives. Whether what is inside matches what was in your head comes down almost entirely to those files, and to whether you read them before you paid.

Gerber and Excellon are the two formats a bare-board fab actually consumes. They are older than most of the people using them, deliberately boring, and far more honest than the glossy 3D render your design tool shows you (that render is a preview, the Gerber is the contract). This post opens the files up, says what each one holds and why, and walks through what a CAM engineer at the fab checks the moment they land, using the PCB layout exporter and design rule check inside NevilLabs as the worked example, all in the browser with nothing to install.

What You Will Learn

  • Why a board is sent as one Gerber file per layer rather than a single drawing, and which extension maps to which layer
  • What the format and unit lines at the top of an RS-274X file (%FSLAX64Y64*% and %MOMM*%) actually declare
  • Why coordinate format and zero handling matter, and how a mismatch shifts a whole board by a factor of ten
  • What an aperture (a D-code) is, and how traces are drawn while pads are flashed
  • How an Excellon drill file carries a tool table, and why plated and non-plated holes need to be told apart
  • Why running a design rule check against your fab's real limits comes before export, not after
  • Why opening the output in an independent viewer is the cheapest insurance in hardware

What a Fab Actually Needs

A bare-board fab does not build from your schematic, your netlist, or your design file. It builds from a set of 2D images, one per physical layer of the board, plus a list of holes to drill. That is the whole handover. Everything a photoplotter or a laser direct imager needs to make the copper, the solder mask and the legend is in those images, and everything the drilling machine needs is in the drill file.

Splitting a board into one file per layer is not an accident of history, it is how the board is physically made. Each layer is manufactured in a separate step on separate material, so each gets its own image. A two-layer board is already five or six images once you count both copper layers, both solder masks and the silkscreen, before you reach the drill file and the outline. Keeping them separate means the fab can image each one on the right process without having to guess which marks belong to which step.

Gerber: One File Per Layer

Gerber is a vector format: it describes shapes with coordinates and draw commands rather than a grid of pixels, which is why it scales to a photoplotter's resolution without going fuzzy. The current form is RS-274X, also called Extended Gerber, maintained by Ucamco (the plain RS-274D variant, with aperture definitions kept in a separate file, was formally withdrawn in 2014 and should never be sent anywhere). NevilLabs writes RS-274X, and each layer that has anything on it becomes its own file.

The file extension is a convention, not a rule, but a widely followed one. In NevilLabs the exporter maps each layer type to the extension a CAM engineer expects to see:

  • Copper layers become .gtl: the actual traces, pads and pours that carry current
  • Solder mask becomes .gts: the lacquer that covers copper everywhere except where you want to solder
  • Silkscreen becomes .gto: the white (usually) legend, reference designators and logos
  • Solder paste becomes .gtp: the stencil openings for surface-mount assembly, not a layer of the board itself
  • The mechanical or outline layer becomes .gm1: the board's physical edge, which tells the fab where to cut

That outline layer earns a sentence of its own. The board edge is just another Gerber image, a closed shape on a mechanical layer, and the fab routes or scores the board to it. Leave it out and the fab has to guess your board's size and shape, which is exactly the kind of guess you do not want a stranger making on your behalf.

The Two Lines That Set Everything: Format and Units

Near the top of every RS-274X file are two short declarations that decide how every number after them is read. NevilLabs writes %FSLAX64Y64*% and %MOMM*%. The second is the easy one: MO is the mode, MM means millimetres (the alternative is IN for inches). Get this wrong between tool and fab and your 50 mm board arrives at 50 thousandths of an inch, which is roughly the size of this full stop.

The first line is the format specification, and it is where careers quietly go sideways. FSLA sets format, leading zeros omitted (L), absolute coordinates (A). The X64Y64 is the part to stare at: six integer digits and four decimal digits per coordinate. So in NevilLabs' files a coordinate is written as an integer that is the millimetre value multiplied by ten thousand (12.5 mm becomes 125000), with no decimal point in the file at all. The reader has to know the format to put the decimal point back in the right place. A tool that assumes a different split, say 2.6 or 4.6, will place every point in the wrong decade, and the classic symptom is a board that comes out ten or a hundred times too big or too small.

This is why zero suppression and coordinate format are not pedantry. Modern RS-274X settled this by making the format explicit in the file and recommending that no zeros be dropped at all, so there is nothing to misread. Older workflows that stripped leading or trailing zeros to save bytes are the source of a long tail of mangled boards. If you want the longer history of how one design turns into these views in the first place, our post on one design, three views covers the layout-to-export path.

Apertures, Draws and Flashes

A Gerber file draws with a set of defined shapes called apertures, each given a D-code (a number from D10 upwards). The name is a leftover from the photoplotters that physically shone light through a wheel of real apertures; the metaphor stuck. NevilLabs generates the apertures a layer needs and defines them with %ADD...% commands: a circle (C) for round pads, traces and via rings, a rectangle (R) for rectangular pads, and an obround (O) for oval pads.

There are two things you do with an aperture, and the distinction is the whole model. You draw with it (select the aperture, move to a start point with a D02 command, then draw lines to each following point with D01) to make a trace: the aperture's shape becomes the width of the line. Or you flash it (move to a location and stamp it once with a D03) to make a pad: the shape is placed down whole, like a rubber stamp. A trace is a dragged brush, a pad is a single stamp. Copper pours, meanwhile, are filled regions, written as a boundary between G36 and G37 markers rather than as a very fat trace.

NevilLabs Export Layout dialog with the Gerber RS-274X format tab selected, a list of layer checkboxes for top and bottom copper, silkscreen and solder mask, and an output box listing the file extensions gtl, gto, gts, gtp, gm1 and xln
The export dialog in NevilLabs. The output box names exactly which files you are about to get, in 6.4 millimetre format, before you commit.

Excellon: The Holes

Copper images cannot describe a hole, because a hole is not a shape on a layer, it is an instruction to a drilling machine. That is a separate file in the Excellon format (named after the drilling-machine maker), and NevilLabs writes one file, drill.xln, covering every via and every through-hole pad in the design.

An Excellon file has two parts. The header, between M48 and a lone %, declares the units and sets up a tool table: NevilLabs writes METRIC,LZ (metric units, leading zeros kept) and FMAT,2 (format 2), then one tool per distinct drill diameter, as lines like T01C0.3000 and T02C0.8000 (tool 1 is a 0.3 mm drill, tool 2 is 0.8 mm). The body then selects a tool and lists the X/Y coordinates to drill with it, grouping all the 0.3 mm holes under T01, all the 0.8 mm holes under T02, and so on, before M30 ends the file. Grouping by tool is literally how the machine works: it loads one drill bit, hits every hole of that size, then changes bits.

One subtlety is worth knowing when you read any drill file. It lists diameters and locations, which is what gets the holes in the right places at the right sizes. What a plain Excellon file does not say by itself is which holes are plated through (lined with copper to connect layers, like a via) and which are not (a mounting hole, say). Fabs infer this, ask, or expect a separate plated and non-plated file, and getting it wrong means a mounting hole comes back copper-lined or a via comes back as a bare hole that connects nothing. If your holes have both kinds, confirm how your fab wants them split before you order.

Annotated diagram of an Excellon drill file: an M48 header with METRIC and FMAT,2 lines, a two-row tool table defining T01 as a 0.3 millimetre drill and T02 as a 0.8 millimetre drill, and a list of X and Y hole coordinates grouped under each tool
Anatomy of an Excellon file. The tool table at the top defines each drill diameter; the body lists where to drill, grouped one tool at a time.

Run DRC Before You Export, Not After

An export is a faithful recording of what you drew. It is not a promise that what you drew can be built. The gap between the two is the design rule check (DRC), and it belongs before export, while you can still fix things. NevilLabs runs DRC from the same toolbar as the exporter: it checks minimum trace width, clearance between copper on different nets, drill size, annular ring (the copper collar left around a drilled hole) and the gap between silkscreen and copper, then groups every violation by type so you can work through them.

The rules themselves are just numbers (NevilLabs reads them from a plain list, one rule and its value per line) and the starting values are a general-purpose set in millimetres: a 0.2 mm minimum trace width and clearance, a 0.3 mm minimum drill, a 0.15 mm minimum annular ring. Which brings us to the numbers that matter most: your fab's own.

Fab Capabilities and Checking Gerbers Before You Order

A clean DRC means your design obeys the rules you gave it. Whether your fab can make the board depends on whether those rules are your fab's numbers. Every fab publishes its own capability table: minimum trace and space, minimum drill, minimum annular ring, smallest solder-mask sliver, and a dozen other limits that vary with the process and the price you are paying. The honest workflow is to copy your chosen fab's limits into the rule list and run DRC against those, rather than a generic set that might be looser or tighter than what the fab guarantees. A board that passes a generic check and fails the fab's own check is the single most common reason a cheap order turns into a redesign.

The second reality is the one that has saved me more boards than any rule file: open the exported Gerbers in an independent viewer before you pay. Not the viewer built into the tool that wrote them (that one agrees with itself by construction), but a separate program that reads the files cold, the way the fab will. Load every layer, flip to the bottom, check the silkscreen is not mirrored, confirm the outline is a closed shape, and make sure the drill hits land on the pads. Mismatched units or a wrong coordinate format jump out instantly at this stage and cost nothing to fix. Discovered on delivered boards, they cost the whole run.

And the last one: plain RS-274X files describe copper, mask, legend and holes. Which holes are plated, impedance targets and the stackup travel separately, in your fab notes, and the machine-readable attributes of Gerber X2 and the Gerber job file are an optional extra layer on top of the images. For anything the images cannot express, have the short conversation with the fab before you order, because that is where surprises are cheapest to remove.

Where Gerber Files Go in the Real World

  • Bare-board fabrication: photoplotters and laser direct imagers build each copper, mask and legend layer from its own RS-274X image, which is why the format is maintained as the industry handover standard (Ucamco, The Gerber Layer Format Specification). High-volume fabs such as JLCPCB and PCBWay take a ZIP of Gerber and drill files directly and show a layer preview before you confirm an order, and OSH Park detects standard KiCad Gerber filenames on upload and renders each layer for review.
  • Drilling and routing: CNC drilling machines consume the Excellon tool table and coordinate list directly, loading one bit per tool number and visiting every hole of that size (Coombs and Holden, Printed Circuits Handbook).
  • Design for manufacturability: a board is checked against a fab's documented minimum trace, space, drill and annular ring before it is committed, following the clearance and spacing principles in the generic design standard (IPC-2221B, Generic Standard on Printed Board Design). KiCad plots RS-274X Gerbers and Excellon drill files, Altium Designer's output is the reference many fabs quote their requirements against, and the free viewer gerbv is an independent check of what the fab will receive.
  • Assembly and data exchange: richer intelligent formats carry netlist, stackup and component data alongside the images, which is the problem IPC-2581 and Gerber X3 set out to solve for the design-to-manufacturing handoff (IPC-2581 Consortium; Ucamco, Gerber X3).
  • NevilLabs exports a PCB layout as RS-274X Gerbers (one file per copper, solder-mask, silkscreen, paste and mechanical layer, in 6.4 millimetre format) plus an Excellon drill file, from a browser, with a design rule check for trace width, clearance, drill size, annular ring and silk-to-copper spacing on the same toolbar.
The render is a preview. The Gerber is the contract. Read the contract in a second viewer before you sign it with your card.

Open the Files Before You Order

If you take one habit from this, make it the two-minute independent check: export the Gerbers and the drill file, open them in a separate viewer, and look at every layer, the mirror of the bottom side, the board outline and the drill alignment, before any money moves. Then set your DRC rules to your actual fab's limits and run it again. These files are deliberately dull precisely so that nothing is hidden in them, which only helps if you actually look.

In NevilLabs the whole path (schematic, layout, design rule check, then Gerber and Excellon) sits in one browser workspace, so you can export, check and re-export in minutes. That is worth doing early, because it is where an abstract design becomes a real cost. If this is the stage of your work where things have surprised you before, see how it connects to the full flow in our post on the circuit-to-PCB path, join the waitlist, and bring the board you are most curious about. Take your time with the files, and the board you have pictured will become something you can hold.

References

  1. Ucamco. (2024). The Gerber Layer Format Specification, Revision 2024.05. Ucamco NV. — https://www.ucamco.com/files/content/files/the-gerber-layer-format-specification-revision-2024-05_en.pdf (opens in a new tab)
  2. Ucamco. Gerber format downloads and current revision. — https://www.ucamco.com/en/gerber/downloads (opens in a new tab)
  3. Ucamco. Standard Gerber (RS-274D) is obsolete. — https://www.ucamco.com/en/gerber/standard-gerber (opens in a new tab)
  4. Ucamco. Gerber X3 for component data in assembly. — https://www.ucamco.com/en/gerber/gerber-x3 (opens in a new tab)
  5. Ucamco. The Gerber Job File. — https://www.ucamco.com/en/gerber/gerber-job-file (opens in a new tab)
  6. Ucamco. Reference Gerber Viewer. — https://www.ucamco.com/en/gerber/reference-gerber-viewer (opens in a new tab)
  7. IPC. (2012). IPC-2221B, Generic Standard on Printed Board Design (table of contents). IPC — Association Connecting Electronics Industries. — https://www.ipc.org/TOC/IPC-2221B.pdf (opens in a new tab)
  8. IPC-2581 Consortium. The IPC-2581 open data exchange standard for PCB design and manufacturing. — https://ipc2581.com/ (opens in a new tab)
  9. Coombs, C. F., & Holden, H. T. (2016). Printed Circuits Handbook (7th ed.). McGraw-Hill Education. — https://www.mhprofessional.com/printed-circuits-handbook-seventh-edition-9780071833943-usa (opens in a new tab)
  10. Artwork Conversion Software. Excellon drill file format reference. — https://www.artwork.com/gerber/drl2laser/excellon/index.htm (opens in a new tab)
  11. KiCad. Discover KiCad (plotting Gerber and drill files). — https://www.kicad.org/discover/ (opens in a new tab)
  12. gerbv. A free/open-source Gerber, Excellon and pick-and-place viewer. — https://gerbv.github.io/ (opens in a new tab)
  13. OSH Park. Generating Gerbers from KiCad (documentation). — https://docs.oshpark.com/design-tools/kicad/generating-kicad-gerbers/ (opens in a new tab)
  14. JLCPCB. How to generate Gerber and drill files (help centre). — https://jlcpcb.com/help/article/how-to-generate-gerber-and-drill-files-in-kicad-7 (opens in a new tab)

Start your first build with NevilLabs

Design a circuit, run the simulation, and see the physics behind it — in your browser. We're inviting early users in small batches.

Join the Waitlist

More articles

Education
Explore Your Potential with Experiential Learning: A Comprehensive Guide to STEM Education
Inspiration
Sir M. Visvesvaraya: Explorer, Creator, Scholar
Inspiration
C.V. Raman: The Light That Changed Physics
Wireless
Guglielmo Marconi: The Engineer Who Shrank the Planet
Technology
Inside a Quadcopter: The Engineering That Keeps Drones in the Air
Physics
Newton's Laws of Motion: A Visual Guide to Forces, Inertia, and Action-Reaction
Education
Why Virtual Labs Are Rewriting the Economics of STEM Education
Simulation
Multi-Domain Simulation: Why Splitting Analog and Digital Tools Is a Mistake
RF
RF Simulation and Yield Analysis: Reading a Smith Chart Before You Fabricate
Electronics
VirtuBuild Space: Taking One Circuit From Breadboard to PCB Without Leaving the Browser
AI Design
Prompt-to-3D-Structure: What AI-Generated Geometry Is Actually Good For
Design
One Design, Three Views: Why Layout, 2D, and 3D Shouldn't Be Separate Files
Robotics
Mechatronics Simulation: Where Circuits Stop Being Circuits and Become Machines
AI
What an AI Debugging Assistant Can (and Can't) See in Your Circuit
Learning
Adaptive Learning Paths: Why 'Personalised Pace' Only Works If the Physics Is Real
Safety
What 'Child Safety' Actually Means in a STEM Simulation Platform
Visualization
Visualizing the Invisible: What 3D Field Simulation Actually Shows You
Education
What a STEM Lab Actually Costs: A Budget Framework for Administrators
Electronics
Inside the 555 Timer: Build One, Then Make an LED Flash
Electronics
Reading a Bode Plot for the First Time (an RC Filter Walkthrough)
RF
FEM vs FDTD: Choosing a 3D Solver for a Patch Antenna
Materials
Material Science You Can Test: Interactive 3D Experiments
Electronics
Resistor E-Series Explained: What E12, E24 and E96 Mean
RF
RF Cascade Analysis: Gain, Noise Figure, IIP3 and P1dB Through a Chain
Simulation
Spice Simulation Online: What .tran and .ac Results Actually Tell You
Materials
The Stress-Strain Curve: Tensile, Compressive and Shear, Explained
RF
From Datasheet to Smith Chart: Importing Touchstone S-Parameters