CAM Files Format

And how they are handled by FlatCAM


The Excellon file format specifies how a circuit board should be drilled. Here is the full specification.

Here is what an Excellon file looks like:

; This line is a comment and is ignored
; The next line starts the "header":
; Units and number format:
; One tool is defined with diameter 0.04 inches,
; drill rate of 300 inches/minute and 55000 RPM.
; End of header, M95 or %, and beginning of body:

; Use tool 1 defined in the header
; Drill at points (123.45, 234.5) and (12.345, 234.5):
; End of program;

Probably the largest source of confusion with Excellon files is the number format. This is in part due to ambiguity and inconsistency in the specification of the format itself. Here is how to interpret numbers in the coordinates:

  1. If the coordinates have a period, the value is taken as is.
  2. Determine the units. These are specified with INCH or METRIC in the header, or with M72 or M71 respectively. If the units are inches the base format is 00.0000. If the units are millimeters, it's 000.000.
  3. Determine if leading or trailing zeros are used. This is specified as INCH,LZ or INCH,TZ (Assuming inches are used). If leading zeros, it means all zeros to the left are already present. If trailing zeros, all zeros to the right are already present.

Example: Assume INCH,LZ and a coordinate pair X12345Y023456. For the X value, complete the number of digits adding zeros to the right: 123450. Then shift the period to obtain 12.3456. For the Y value, we already have 6 digits, so just shift the period (and discard the 0 that is meaningless) to obtain 2.3456.

If trailing zeros are used (INCH,TZ), complete the total digits by adding zeros to the left. Then shift the period. If using millimeters it's exactly the same, but after completing the 6 digits, the period is shifted 3 digits instead of 4.

Support of Excellon in FlatCAM

  • FlatCAM only reads Excellon. It does not write Excellon.
  • FlatCAM supports only the drilling subset of Excellon. Routing is not supported (!).
  • All machine-related instructions are ignored. FlatCAM uses an Excellon file only to determine where to drill.
  • Units default to INCHES.
  • Zeros default to leading (L).
  • Base format is 00.0000 and 000.000 for inches and millimeter respectively. This will match at least 95% of Excellon files generated by most software.
  • (!) = At this time but might be implemented in the future.


The Gerber format specifies polygons. Shapes that have an area. Most commonly copper regions in a specific layer of a PCB. It is also used for solder masks, solder paste and artwork. Here is the full specification.

Here is what a Gerber file looks like:

G04 This line is a comment an is ignored.*
G04 Coordinate format specification:*
G04 Set units to inches:*
G04 Define an aperture:*
G04 Change polarity to DARK:*
G04 Select the the previously defined aperture:*
G04 Set interpolation mode to linear:*
G04 Move to (0, 0) without drawing:*
G04 Draw to (5, 5) using aperture 10:*
G04 Enf of file:*

Support of Gerber in FlatCAM

  • The Gerber format is almost fully implemented in FlatCAM except for certain minor features.
  • Holes in standard apertures (C, R, O and P) are not supported (!).
  • Drawing (interpolation) is always done with a circular aperture even if a non-circular aperture is chosen. An equivalent size is calculated from the dimensions of the aperture and used as the diameter of a circular aperture. This is unlikely to ever affect a gerber for a PCB. This limitation does not affect flashing.
  • Step and Repeat (SR) is not supported (!).
  • (!) = At this time but might be implemented in the future.