Gerber format
The Gerber format is a human-readable, open vector image format for two-dimensional binary images, serving as the de facto industry standard for transferring printed circuit board (PCB) design data from computer-aided design (CAD) software to computer-aided manufacturing (CAM) systems for fabrication and assembly.[1] It specifies graphical elements such as copper layers, solder masks, silkscreens, and drill data, enabling precise visualization, image processing, and production of PCB images with infinite resolution.[1] As a complete, self-contained file format using UTF-8 encoding with printable 7-bit ASCII commands, it requires no external parameters and can be processed in a single pass, making it portable, debuggable, and widely supported by PCB design and fabrication tools.[1] Originally developed in 1980 by Gerber Systems Corporation as Standard Gerber (EIA RS-274-D) for vector photoplotters, the format evolved in 1998 into Extended Gerber (RS-274X) to accommodate raster plotters and modern imaging needs.[1] Maintained by Ucamco (formerly Barco), it has undergone continuous revisions based on industry feedback, with key updates including the deprecation of Standard Gerber in 2012, the introduction of Gerber X2 attributes in 2014 for metadata like netlists and pad types, block apertures and transformations in 2016, and Gerber X3 component data in 2020.[1] The latest revision, 2024.05, supersedes all prior versions and emphasizes backward compatibility while adding features like nested step-and-repeat for pattern replication.[1] Key features include 27 simple commands for graphical objects such as lines, arcs, flashes, and regions; aperture definitions via standard shapes, macros, or blocks; and embedded attributes for fabrication details like layer function, polarity, and numerical accuracy guidelines of ±0.5 μm.[1] A companion Gerber Job File (GJO) format, introduced in 2018, bundles multiple layer files with stack-up and process specifications to streamline data transfer.[2] Despite its longevity, the format remains field-tested and essential to electronics manufacturing, ensuring reliable communication between designers and fabricators worldwide.[3]Overview
Purpose and Applications
The Gerber format is an open, ASCII-based vector image format specifically designed for representing 2D binary images in printed circuit board (PCB) production. It enables the precise depiction of graphical elements as on/off patterns, facilitating the transfer of PCB design data between software systems.[1] Its primary applications lie in PCB manufacturing workflows, where it conveys layer-specific images from computer-aided design (CAD) tools to computer-aided manufacturing (CAM) systems. This includes defining copper traces for conductive paths, solder masks to protect non-soldered areas, silkscreen for component labels and markings, drill hits for via and hole placement, and other fabrication layers essential for producing functional circuit boards. By standardizing this data exchange, Gerber ensures compatibility across diverse design and production environments, minimizing errors in the transition from digital blueprints to physical prototypes and high-volume manufacturing.[3] The format supports key vector primitives such as lines, arcs, polygons, and flashes, which allow for the accurate rendering of complex geometries required in photoplotting and direct imaging processes. Since the 1980s, Gerber has established itself as the de facto industry standard for PCB image data transfer, with every major design system capable of generating it and fabrication facilities relying on it for input. Maintained by Ucamco—the Belgian company that acquired the PCB division of Gerber Scientific in 1997—it was originally developed in 1980 for vector photoplotters and has evolved into the foundational backbone of modern digital fabrication data exchange.[1][4][5]Format Characteristics
The Gerber format is an open, ASCII-based vector image format designed for representing printed circuit board (PCB) designs, utilizing printable 7-bit ASCII characters (ANSI X3.4-1986) for all commands and names to ensure human readability and portability across systems.[1] While commands adhere to 7-bit ASCII, the format supports full UTF-8 encoding for attribute values and strings, facilitating compatibility with diverse text editors and international character sets.[1] As a vector-based system, Gerber stores precise coordinates and instructions for drawing 2D bi-level (binary) images using graphical primitives such as lines, arcs, and flashes, rather than raster pixels, which allows for resolution-independent scaling and exact replication in manufacturing processes.[1] This structure enables the format to define PCB layers like copper traces or solder masks through superimposed vector objects, processed sequentially in a single pass without requiring external references.[1] Gerber files follow a linear, plain-text structure: they begin with essential header commands, such as %FS* to specify the coordinate format (including precision and notation) and %MO* to set units, followed by aperture definitions via %ADD* commands that outline shapes like circles or rectangles, then the core image data comprising coordinate sequences and operation codes (e.g., D01 for drawing, D03 for flashing), and conclude with end-of-image markers like M02*.[1] Being plain text files, they are fully editable in any standard text editor, with each line typically delivering a discrete instruction interpretable by photoplotters, CNC mills, or direct imaging equipment.[1] A single PCB design requires multiple Gerber files—one per layer—to capture the full stackup, and these are commonly archived in ZIP format alongside complementary data like Excellon-format drill files for hole placement and, in some cases, netlists for electrical verification.[1][6] Coordinate units are explicitly declared via the %MO* command as either inches (%MOIN*) or millimeters (%MOMM*), appearing once in the header for consistency, while positioning modes—absolute or incremental (relative)—are configured in the %FS* command to define how subsequent coordinates are interpreted relative to origins or prior points.[1]Technical Specifications
Aperture System
In the Gerber format, apertures serve as virtual drawing tools or shapes that define the geometry of graphical primitives used to generate printed circuit board (PCB) images. These 2D plane figures, such as circles, rectangles, obrounds (oval-like), and polygons, are essential for precisely rendering features like traces, pads, and outlines.[1] Apertures must be defined in the file before use, ensuring that fabrication equipment can interpret and apply them consistently across layers.[1] Standard apertures are added to an aperture list—a dictionary of enumerated shapes—using the%ADDnn command, where nn is the aperture number starting from 10. For example, a circular aperture is defined as %ADD10C,0.5*% for a 0.5-unit diameter circle, while a rectangular one uses %ADD11R,1.0X0.5*% for a 1.0 by 0.5 unit rectangle.[1] More complex shapes, such as thermal pads or custom polygons, are created via aperture macros with the %AM command, which combines primitives like circles, lines, and outlines into parameterized templates; an example is %AMTHERMAL*4,1,45,0.8X0.6,0.2*% for a cross-shaped thermal relief pad.[1] Block apertures, defined using the %AB command since the 2016 revision, allow creating complex apertures as blocks of primitives that can be transformed (scaled, rotated, mirrored) and reused, complementing macros for larger structures like panelized boards.[1] The aperture list supports up to 65,535 entries per file in practice, though the specification imposes no strict numerical limit beyond requiring unique identifiers greater than or equal to 10.[1]
Apertures are selected for use via D-codes in the format Dnn*, where nn specifies the aperture number, such as D10* to activate aperture 10.[1] Once selected, the aperture can be applied through flashing or drawing operations: flashing places the full shape at a specified coordinate using XD03* (e.g., for via pads or component pads), while drawing strokes the shape along a path with D01* for both linear traces (G01* mode) and circular arcs (G02* or G03* mode), enabling precise control over trace widths and curved outlines.[1] Standard shapes include round (C for circles), rectangular (R), obround (O), and polygonal (P, e.g., %ADD12P,0.6X4,0*% for a rotated square), each with optional parameters for size, rotation, and holes to accommodate features like drilled vias.[1]
This system ensures high fidelity in PCB fabrication by allowing apertures to define trace widths through drawing strokes, via and solder pads via flashing, and component outlines via custom macros, all while maintaining compatibility with layer-specific images for traces and other elements.[1]
Commands and Syntax
The Gerber format employs a stream of commands to define the graphics state and generate image data for printed circuit board layers, adhering to a precise, ASCII-based syntax that ensures interoperability across fabrication tools. Commands form the core syntactic elements, with each file consisting of a sequential series of these instructions processed from top to bottom to produce vector graphics objects such as lines, arcs, flashes, and regions. The format is case-sensitive and uses printable ASCII characters (codes 32-126), with commands separated by spaces or line breaks in a free-field structure.[1] Basic syntax rules dictate that operational commands—such as those for movement or imaging—end with an asterisk (), for example,G01* to set linear interpolation mode. Parameter settings, which configure aspects like coordinate formats or apertures, are enclosed in percent-delimited blocks starting with % and ending with *%, such as %FSLAX36Y36*% to specify the format statement (FS) for leading zeros omitted (L), absolute coordinates (A), and 3 integer plus 6 decimal digits (X36Y36) for X and Y axes. These blocks must appear in the file header before any image data, and parameters within them are comma-separated where applicable. The coordinate format specified by the %FS command determines how positions are represented, suppressing leading or trailing zeros to optimize file size while maintaining precision; for instance, in a %FSLAX25Y25% setup (2 integer and 5 decimal digits), the command X12345Y67890D01* draws a line to the absolute position (1.2345, 6.7890) units from the origin using the current aperture.[1]
Movement and imaging are executed through specific command codes that reference the current aperture for rendering primitives. Linear movement and drawing use G01* for straight-line interpolation, combined with D01* to draw a line from the current point to new X/Y coordinates (e.g., X200000Y300000D01*), or D02* to move without drawing (e.g., X100000Y100000D02*). Circular interpolation requires prior activation of single-quadrant mode via G75*, followed by G02* for clockwise arcs or G03* for counterclockwise, specified with endpoint X/Y and center offsets I/J (e.g., G75* G02* X75000Y50000I40000J0D01* draws a clockwise arc). Flashing the current aperture at a point uses D03* (e.g., X0Y0D03*), creating a filled shape at the specified coordinates without interpolation. Apertures are selected via D codes like D10* to activate aperture number 10 before these operations.[1]
For complex primitives like regions (filled polygons), image commands initiate a boundary with G36*, followed by a sequence of D01* or D02* segments to define contours via multiple X/Y points, and terminate with G37* (e.g., G36* X200000Y300000D02* X400000Y300000D01* X400000Y500000D01* X200000Y500000D01* X200000Y300000D01* G37* outlines a rectangular region). Arcs within regions follow the same G02/G03 rules with I/J offsets. These commands build polygons by connecting points in order, supporting both dark and clear polarities for positive or negative imaging. The syntax ensures primitives are rendered using the active aperture, with no explicit closure required for simple lines but mandatory contour completion for regions to avoid undefined behavior.[1]
Error handling in Gerber processing prioritizes robustness, where invalid or unimplemented commands are typically ignored by compliant readers to prevent file rejection, though warnings may be issued for non-standard elements like self-intersecting contours or missing prerequisites (e.g., undefined apertures or absent G75* before arcs). Files must be validated for full compliance prior to fabrication, as meaningless results can arise from syntactic errors, low-resolution formats (fewer than 6 decimal places), or deprecated codes, ensuring reliable interpretation across tools. Robust file construction, including sufficient precision to avoid rounding issues (e.g., maintaining at least 1 μm separation between features), is recommended to minimize processing failures.[1]
Coordinate and Unit Handling
The Gerber format employs a 2D Cartesian coordinate system with the origin at (0,0), where the positive X-axis points to the right and the positive Y-axis points upward, as viewed from the top side of the board.[1] This system supports absolute coordinates as the default mode, ensuring precise positioning of graphical objects relative to the origin, while incremental mode—specified via the format statement—is deprecated due to potential rounding errors in path interpolation.[1] Coordinates are represented as signed integers for both X and Y axes, prefixed by their axis letter (e.g.,X123Y-456 or X-25000000Y-2000000), and must be interpreted in the context of the file's unit and precision settings to accurately depict PCB geometries.[1]
Units in Gerber files are explicitly defined using the Mode (MO) command in the file header, with %MOMM* specifying millimeters as the primary unit and %MOIN* specifying inches; this command must appear exactly once per file and applies to all coordinates and dimensions thereafter.[1] For example, a coordinate value of 10000 in a millimeter-based file corresponds to 10 mm, enabling seamless integration with international manufacturing standards.[1] Offsets, once handled via the deprecated Offset (OF) command (e.g., %OFA1.0B-1.5* to shift the image by 1 unit in X and -1.5 in Y), are now recommended to be implemented directly through adjusted coordinate data to avoid compatibility issues.[1]
Precision and resolution are controlled by the Format Specification (FS) command, which must precede the first coordinate and defines the number of integer and decimal digits for X and Y (e.g., %FSLAX36Y36* for absolute notation with leading zeros suppressed and 3 integer plus 6 decimal digits).[1] This format allows resolutions as fine as 0.000001 units (1 nm in millimeters) for high-precision applications, though configurations with fewer than 6 decimal places are deprecated to ensure sub-micrometer accuracy in modern PCB fabrication.[1] In a 3.5 format (3 integer, 5 decimal digits), for instance, the smallest resolvable step is 0.00001 units, sufficient for many standard boards but limiting for advanced high-density interconnects.[1]
Scaling and transformations are managed through specific commands to adapt designs without altering source data. The Scale Factor (SF) command (e.g., %SFA0.5B3* to scale X by 0.5 and Y by 3) has been deprecated since 2012, with scaling now preferred via direct coordinate multiplication in the design software.[1] Mirroring, essential for bottom-layer representations, is set using the Load Polarity/Mirroring (LM) command (e.g., %LMXY* for both X and Y axes), which inverts coordinates across the respective axis without affecting aperture definitions and can be applied multiple times within a file.[1] Step-and-repeat functionality, via the Step and Repeat (SR) command (e.g., %SRX2Y3I2.0J3.0* to replicate a 2x3 array with 2-unit X steps and 3-unit Y steps), enables efficient tiling of repeated patterns like panelized boards, supporting nested repetitions for complex layouts.[1] These mechanisms collectively ensure that Gerber files maintain geometric fidelity across diverse manufacturing scales and orientations.[1]