← Back to the Gerber Viewer

How to Convert Gerber Files to DXF for Mechanical CAD

Convert Gerber data or PCB outlines to DXF for enclosure design, mechanical CAD reference, CNC, and laser workflows.

Updated July 2026 · Online Gerber Viewer Team

Already have a ZIP or a folder of fabrication outputs? Open the free Gerber viewer and inspect the layers before you send them to a board house.

DXF is a mechanical CAD vector format. Converting Gerber data to DXF is common when electrical PCB data needs to become reference geometry for an enclosure, panel, laser process, CNC fixture, assembly drawing, or mechanical clearance check. The best route depends on what geometry you actually need. In many cases, the answer is not full Gerber-to-DXF conversion; it is a clean board outline and hole DXF from the original PCB editor.

A Gerber file is a PCB manufacturing image. It might contain top copper, solder mask openings, silkscreen artwork, paste apertures, or the board outline. A DXF file is usually consumed by mechanical CAD systems such as AutoCAD, Fusion, SolidWorks, FreeCAD, and CAM tools. Because the two formats come from different worlds, conversions can create many short line segments, filled polygons, or confusing layer names if you export more data than the mechanical user needs.

This site's Gerber viewer does not export DXF. Use it to preview the Gerber ZIP, identify which file is the outline layer, and confirm whether drill data is included. Then use an EDA, CAM, or dedicated conversion tool to create the DXF.

Quick answer

For enclosure and mechanical CAD work, export the board outline, mounting holes, and mechanical features directly as DXF from the PCB editor when possible. If you only have Gerbers, identify the outline layer in a viewer, then use a CAM or dedicated Gerber-to-DXF converter.

Decide what the DXF must contain

Before converting anything, decide whether you need the board outline, the drill map, copper geometry, silkscreen graphics, or all of those layers. Most mechanical workflows need far less than a full PCB stack. An enclosure designer usually needs the outside profile, cutouts, mounting holes, connector locations, button openings, display windows, and maybe a few keepout regions. They rarely need every copper pour or solder mask opening.

Full copper DXF can be useful for special cases such as artwork, electromagnetic reference, reverse engineering, custom heat spreader checks, or nonstandard fabrication planning. It can also create a very large and hard-to-edit file. If your CAD user only wants to see where the PCB fits in a housing, exporting copper is usually a distraction.

Use the viewer to find likely outline files. KiCad outputs often use an Edge.Cuts layer, while many Protel-style packages use extensions such as .gko, .gm1, or another mechanical Gerber. Drill files may use .drl or .xln. If you are not sure what a file is, the Gerber opening guide has a layer-extension reference.

Best method: export DXF from the PCB editor

If you have the original PCB project, export DXF from the PCB editor rather than converting Gerber output. The board editor knows which geometry is the outline, which holes are mechanical, and which layers are construction or documentation. That usually produces cleaner DXF geometry with fewer unnecessary shapes.

In this workflow, open the PCB layout, choose the tool's DXF export or mechanical drawing export feature, select the board outline and relevant mechanical layers, choose units, and export. Exact menus differ across KiCad, Altium Designer, EAGLE or Fusion Electronics, EasyEDA, and OrCAD or Allegro. The principle is the same: export the mechanical intent from the design database before it has been flattened into Gerber image layers.

After import into CAD, measure known dimensions. Check board width, board height, and mounting-hole spacing. If a 50 mm board imports as 1.9685 units, the CAD tool may be treating millimeters as inches or the reverse. Fix unit interpretation immediately before using the geometry for enclosure design.

When you only have Gerber files

If the original CAD project is unavailable, convert the Gerber layer that contains the geometry you need. Start by opening the ZIP and identifying the outline. A dedicated Gerber-to-DXF converter or CAM tool can then read that layer and write DXF. Some Gerber viewers and CAM packages can export vector formats; DXF support is more tool-specific than PNG, SVG, or PDF, so verify the actual output options in the tool you use.

Keep the conversion narrow. If the outline is in a separate .gko or .gm1 file, convert that file first. If holes are needed, include the Excellon drill file or import hole positions separately. Avoid converting every copper layer unless there is a clear reason because the resulting DXF may contain thousands of filled shapes that slow down mechanical CAD.

After conversion, inspect the DXF visually and dimensionally. Imported arcs may become polylines, slots may become outlines rather than true slot features, and filled copper regions may become dense contours. Those behaviors are often acceptable for reference geometry but risky if you treat the DXF as an editable manufacturing master.

Gerber-to-DXF route reference

What you needRecommended routeWhy
Board outline onlyExport DXF from the PCB editor, or convert the outline Gerber.Cleanest geometry and easiest CAD import.
Outline plus mounting holesExport mechanical DXF with holes, or combine outline and drill data.Enclosure work usually depends on hole positions.
Copper referenceConvert selected copper Gerbers through a CAM or dedicated converter.Useful only when copper shapes matter mechanically.
Drill map drawingUse Excellon drill data or a drill drawing export from the EDA tool.Drills are not fully defined by copper pads alone.

Verify the source before converting

Open the source Gerbers in the viewer before conversion. Confirm that the outline is complete, cutouts are visible, and drill holes appear where the mechanical CAD user expects them. If you need a simple visual reference to send with the DXF, create a board image with the Gerber to PNG workflow so the recipient can compare the imported DXF against a rendered view.

Do not fix a bad DXF by guessing at geometry in CAD unless you also correct the source PCB data. If the outline Gerber is missing, shifted, or different from the intended board shape, regenerate the fabrication package or ask for the original PCB project. A clean conversion depends on clean source data.

FAQ

Do I need full copper in DXF or just the board outline?
For most mechanical CAD and enclosure workflows, you only need the board outline, mounting holes, slots, and connector keepout references. Full copper DXF is usually unnecessary and can be heavy.
Is a DXF converted from Gerber a manufacturable Gerber replacement?
No. DXF is a mechanical CAD exchange format. It can be useful reference geometry, but PCB fabrication should use Gerber and Excellon drill files.
How do I avoid scale problems when importing DXF?
Confirm units during export and import, then measure a known board dimension or mounting-hole spacing in the CAD tool. Millimeters versus inches is the most common mistake.
Can AutoCAD or Fusion import a Gerber-derived DXF?
Yes, they can import DXF, but the quality depends on how the DXF was created. A direct outline DXF from the PCB editor is usually cleaner than a full copper conversion from Gerber.

Related guides