# Gerber format: history, variants and viewer

> What the Gerber format is and where it comes from, its variants (RS-274D, RS-274X, X2), the Excellon drill file, how a PCB's layers compose and why many manufacturers today prefer formats like ODB++ and IPC-2581.

Published: 2026-06-24
Updated: 2026-08-25
Practice: elettronica
Standard: Gerber format: history, variants and viewer <https://en.wikipedia.org/wiki/Gerber_format>

Page: <https://www.stline.it/en/wiki/gerber-viewer/>

---

A printed circuit board is not described by a single file: each **physical layer** is its own file, and to see it you have to recompose them all, aligned. This page explains where the Gerber format comes from, which variants exist, which files make up a board and why many manufacturers today rely on richer formats.

## A short history

The name comes from **Gerber Scientific**, Joseph Gerber's company, which between the 1960s and the 1980s built the vector **photoplotters** used to expose the films from which printed circuit boards were fabricated. The Gerber format began as the control language of those machines — a subset of the EIA **RS-274** standard for numerically controlled machines.

The photoplotter moved a light source: it *flashed* a shape (an **aperture**) at a position to create a pad, or *drew* a line by exposing the film along a path to create a trace. Hence the concepts still central today — aperture, *flash*, *draw* — and the reason a Gerber is a vector drawing, not a raster image. Because every fab read that language, Gerber became the **de-facto standard** for exchanging PCB artwork.

## The format variants

- **RS-274D** (the "standard" Gerber) — carried only the moves; the aperture shapes lived in a **separate file** (the *aperture wheel*) communicated apart. Ambiguous and fragile: one mismatch between the drawing and the aperture table was enough to get the board wrong. Now obsolete.
- **RS-274X** (Extended Gerber, *X1*) — embeds the aperture definitions and the coordinate format in the file, and adds **regions** (G36/G37), **dark/clear polarity** (LPD/LPC), **step-and-repeat** and **aperture macros**. The variant used for decades, and the one this viewer interprets.
- **Gerber X2** (2014) — adds **attributes** (metadata) that declare what each file means: layer function, drill data, netlist attributes. The set becomes **self-describing** instead of relying on filenames. It is maintained by **Ucamco**, the format's heir to Gerber Scientific.
- **Gerber Job File** (`.gbrjob`) — a companion file describing the whole job (stack-up, layer order, materials) alongside the Gerber X2 files.

## The Gerber format in practice (RS-274X)

**Gerber** describes each layer as a sequence of **apertures** (circles, rectangles, custom shapes via macros) that are *flashed* at a position (a pad) or *drawn* along a path (a trace). **RS-274X** embeds both the aperture definitions and the coordinate format; **regions** (G36/G37) fill areas, and **clear polarity** (LPC) "carves" the copper already laid down.

Each Gerber file contains a single layer. A common coordinate system (origin and units) ensures different layers overlay correctly.

### The directive that decides everything: the coordinate format

There is one line, at the start of every file, that determines whether the board will be ten centimetres or ten metres across. Coordinates in Gerber are **integers with no decimal point**: `X1500Y2000` does not say millimetres, it says “fifteen hundred units”, and what a unit is worth is set by the **`FS`** (*Format Specification*) directive together with **`MO`** (*Mode*, inches or millimetres).

| Directive | Integer | Decimal | `X1500` means | If you get it wrong |
|---|---|---|---|---|
| `%FSLAX46Y46*%` | 4 | 6 | 0.0015 mm | reference |
| `%FSLAX35Y35*%` | 3 | 5 | 0.015 mm | × 10 |
| `%FSLAX24Y24*%` | 2 | 4 | 0.15 mm | × 100 |
| `%FSLAX23Y23*%` | 2 | 3 | 1.5 mm | × 1000 |

The form `%FSLAX46Y46*%` reads as follows: `L` = leading zeros omitted, `A` = absolute coordinates, then `X46` = 4 integer and 6 decimal digits for the X coordinate, `Y46` likewise. With `MO` in millimetres, the elementary unit is therefore 10⁻⁶ mm.

The last column of the table is why this directive matters more than all the others: **a one-digit error scales the board by a factor of ten**, and the file opens perfectly. There is no syntax error, no warning: there is a board of the wrong size, which the fab would happily manufacture if the outline file carried the same error. It is also why the first check on a received Gerber is always to **measure something known** — a connector pitch, the board diagonal — and not to look at whether it “seems right”.

Two historical variants still turn up, and have to be recognised. Omitted **trailing** zeros (`T` instead of `L`) still exist in old files and completely change the interpretation of the same digits. And **incremental** coordinates (`I` instead of `A`, with `G91`) have been deprecated for decades but show up in output from ancient CAD: every coordinate is a displacement from the previous one, so a single parsing error shifts everything after it in the layer.

### Arcs: G74 and G75, the bug nobody sees

An arc in Gerber is drawn with `G02` (clockwise) or `G03` (counter-clockwise), giving the end point and the **centre offset** (`I`, `J`) from the start point. But the interpretation of that offset depends on a mode declared separately:

- **`G74`** — *single quadrant*: the arc cannot cross a quadrant, `I` and `J` are unsigned and the direction has to be inferred. A historical, deprecated mode.
- **`G75`** — *multi quadrant*: `I` and `J` are signed and the arc can run up to a full circle. This is the correct mode.

Reading a `G74` file as `G75` (or the reverse) does not produce an error: it produces **arcs going the wrong way round**, or circles where quarter-circles belong. On a copper layer you notice; on a solder-mask layer or a board-outline route, much less — and the part comes out with a different profile from the one drawn. This tool's renderer implements both modes, which is why the distinction shows up here at all.

## The files of a board

A typical board is a set of files, one per physical plane plus drilling and outline:

- **Copper** — one per conductive layer: top, bottom and any inner layers. This is where traces and pads live.
- **Solder mask** — one file per side. Its apertures mark where the copper stays exposed.
- **Silkscreen** — component text and outlines, one file per side.
- **Solder paste** — the stencil apertures for paste on SMD pads, one file per side.
- **Drill (Excellon)** — not a Gerber but a separate Excellon file, with hole coordinates per diameter.
- **Outline (Edge Cuts)** — the board's mechanical contour, a dedicated Gerber.

## Why several files, and how they compose

Separating the layers is necessary because each goes through a different fabrication process (copper etching, silkscreen printing, drilling). To **view** the board you do the inverse: load every file and overlay them, aligned on the same coordinate system, so that pads, traces, mask and holes fall exactly where they should. Each layer gets a colour and can be toggled to inspect the board layer by layer.

## Layer identification

File names are **not standardised** across CADs: the same layer can be called `top.gtl`, `board-F_Cu.gbr` (KiCad), `top_copper.gbr` and so on, and drills can have a `.drl` or `.txt` extension. This is precisely why Gerber X2, by adding function attributes, reduces the ambiguity. The viewer recognises each file's type by combining name/extension and content; stray files (BOM, pick&place, PDF, README) are ignored without error, while an ambiguous layer stays marked as "unknown" and can be assigned by hand.

### Common extensions per layer

| Layer | Typical extensions |
|---|---|
| Copper top / bottom | `.gtl` / `.gbl`, `F_Cu.gbr` / `B_Cu.gbr` |
| Solder mask top / bottom | `.gts` / `.gbs`, `F_Mask.gbr` / `B_Mask.gbr` |
| Silkscreen top / bottom | `.gto` / `.gbo`, `F_Silkscreen.gbr` / `B_Silkscreen.gbr` |
| Paste top / bottom | `.gtp` / `.gbp`, `F_Paste.gbr` / `B_Paste.gbr` |
| Outline | `.gko`, `.gm1`, `Edge_Cuts.gbr` |
| Drill (Excellon) | `.drl`, `.txt`, `.xln` |

The left column is the meaning; the right shows the two most common conventions (Protel/legacy and KiCad). These are examples, not a standard: exactly the ambiguity that the Gerber X2 attributes remove.

### What the renderer actually covers

Saying a viewer “interprets Gerber” means nothing: what counts is which directives it handles, because the missing ones do not raise an error, they draw something different. This is the actual coverage, read from the renderer's source:

| Group | Supported by the renderer | Not supported |
|---|---|---|
| Extended directives | `FS` `MO` `AD` `AM` `AB` `SR` `LP` `LM` `LR` `LS` | `TF`/`TA`/`TO` attributes (X2 metadata: read, not used for drawing) |
| G codes | `G01` `G02` `G03` `G04` `G36` `G37` `G70` `G71` `G74` `G75` `G90` `G91` | — |
| Macro primitives | `1` circle, `4` outline, `5` polygon, `7` thermal, `21` centre line, `22` lower-left line | `2`/`20` vector line, `6` moiré |
| Excellon | `M48` `M71` `M72` `M15` `M16`, tool table | routing with radius compensation |

Three rows deserve a comment. **`AB`** (*Aperture Block*) and **`SR`** (*Step and Repeat*) are the directives that describe a panel — the same board repeated on a grid — and they are the ones simple viewers ignore: the result is that you see one board instead of twelve, and the panel looks wrong when it is the viewer that is incomplete. **`LM`/`LR`/`LS`** (mirror, rotate, scale) are the transformations introduced by Gerber X2: without them, rotated apertures land in the right place with the wrong orientation.

And among the unsupported macro primitives, **`20`** (vector line) is the only one met with any frequency, in macros generated by older CAD; **`6`** (moiré) serves optical fiducial targets and is rare. A macro using them is ignored in the unsupported part rather than failing the load, which is the right choice for a viewer but worth knowing.

## Beyond Gerber: ODB++ and IPC-2581

Classic Gerber describes only the **artwork** of each layer: it does not carry the stack-up, the netlist, the components or the hole spans. For fabrication and especially **assembly** this leaves ambiguities the fab has to fill in by hand. That is why many manufacturers today prefer "intelligent" formats:

- **ODB++** (born at Valor, now Siemens) — not a file but a **database** (a directory tree) that carries copper, drilling, netlist, components, stack-up, test-points and DFM rules in a single package. Widely used to cut setup and back-and-forth with the fab.
- **IPC-2581** (also called *DPMX*) — an **open, vendor-neutral** standard, a single XML file with the full product model (stack-up, netlist, components, drilling, DFM data). Pushed as an open alternative to the proprietary ODB++.

Gerber **X2** narrows the gap by adding attributes, but ODB++ and IPC-2581 are designed to carry netlist, components and stack-up **natively**. In practice a fab almost always accepts Gerber (X2 or RS-274X + Excellon), and in parallel ODB++ or IPC-2581 when the assembly flow requires them.

## How the board is rendered

The board is rasterized on a WebGL2 canvas by an engine written in **Rust and compiled to WebAssembly**: it interprets dark/clear polarity (LPD/LPC) and pour regions (G36/G37) directly, so clearances truly "carve" the copper and traces stay readable even inside a plane. Layers are composited with per-layer transparency, with point-to-point measurements and feature picking.

---

Web tool: **[Gerber Viewer](/en/tools/gerber-viewer/)**. Engine: **WASM Gerber Viewer** (Rust/WASM renderer on WebGL2, MIT).
