Convert DWG to DXF for mask and lithography geometry
This is a geometry-scoped conversion, not a general AutoCAD-fidelity DWG-to-DXF pass.
Your DWG is decoded, re-modelled as mask geometry, and written back out as a DXF built for photomask and lithography tooling. Concretely, that means the output contains only TEXT, LWPOLYLINE and INSERT entities; every arc, circle, ellipse, spline, hatch and solid arrives flattened to a polyline; layers are renamed to encode a (layer, datatype) pair as L1D0; one drawing unit is exactly 1 nm ($INSUNITS = 12); and layer colours are quantised to the AutoCAD Color Index. If that is what your exposure tool or mask shop wants, this is the right conversion. If you need the original entity types back for CAD work, export DXF from the tool that wrote the DWG instead.
Everything runs inside your browser — the DWG is decoded locally, and there is no server to upload it to.
How to convert DWG to DXF
- Drop your
.dwgfile onto the converter on this page. Containers from R14 through R2018 are recognised from the file's own magic bytes. - Confirm the drawing unit, then pick DXF as the target format. The unit you confirm here sets the physical scale; the output itself is always written at 1 unit = 1 nm. Close open contours & heal geometry is checked by default for line art rather than filled regions; untick it to convert the file exactly as drawn.
- Download the
.dxffile. Open it in the free Glyph editor first if you want to check layers and outlines before it reaches an exposure tool.
What survives and what changes
The conversion is two steps — DWG in, DXF out — so both halves' behaviour applies.
Reading the DWG
| Aspect | What happens |
|---|---|
| Containers | R14 → R2018 (AC1014, AC1015, AC1018, AC1021, AC1024, AC1027, AC1032), including R2007's separate page and compression scheme. |
| Entities read | LINE, CIRCLE, ARC, ELLIPSE, LWPOLYLINE, POLYLINE_2D with its VERTEX records, SPLINE, POINT, INSERT, HATCH, SOLID, TRACE, 3DFACE, TEXT, ATTRIB, ATTDEF, MTEXT and DIMENSION (via its picture block). |
| DIMENSION | Drawn from its own anonymous picture block, as in DXF. One whose picture block is missing is counted and reported, never silently dropped. |
| HATCH | Reduced to its boundary loops — a hatch is treated as fill intent, not as pattern geometry. |
| Splines | Both control-point and fit-point representations decode and flatten. A fit-point spline's sampled curve is visually close rather than proven identical to the original CAD tool's. |
| Widened polylines | Constant width and per-vertex widths are read, so a widened track keeps its width instead of collapsing to a hairline. |
| Units | $INSUNITS is offered as a preset only when the header could be read with confidence, and you confirm it — a wrong scale on correct geometry is the most expensive silent error in CAD import. |
| Undecodable data | Counted and reported, never silently swallowed. |
Writing the DXF
| Aspect | What happens |
|---|---|
| Entities written | Only TEXT, LWPOLYLINE and INSERT. This is the scope stated at the top of the page, not a defect. |
| Curves | None survive as curves. Every arc, circle, ellipse and spline is already a polyline by the time the writer runs, because the intermediate model is mask geometry. |
| Units | 1 drawing unit = 1 nm, $INSUNITS = 12, $MEASUREMENT = 1. Coordinates are exact integers at that scale. |
| Layer names | Rewritten to encode a (layer, datatype) pair (L1D0), sanitised to characters AutoCAD accepts and de-duplicated. Original DWG layer names are not carried through. |
| Layer colours | Written as the nearest AutoCAD Color Index plus the exact RGB as a true-colour value (group 420), which tools that read it — Glyph among them — show exactly; a tool that reads only the Color Index sees the nearest swatch. A hidden layer is written with a negative ACI, DXF's "layer is off", never dropped. |
| Hierarchy | Blocks survive as blocks: each cell becomes a DXF BLOCK, an insert becomes an INSERT carrying magnification, rotation and mirroring. |
| Axis-aligned arrays | Written as a single INSERT with DXF's column/row array groups — one entity, however large the array. |
| Other arrays | Expanded instance by instance up to 20 000 instances; past that only the four corner instances are written and a 999 comment in the file says so. |
| Paths | A widened path becomes a constant-width LWPOLYLINE. End-cap style has no DXF equivalent and is lost — the result is always flush-capped. |
| Text | A plain TEXT entity in the Standard style. Font, letter spacing and justification collapse into the resolved anchor offset. |
| Validation | The DXF writer is checked on every build against ezdxf, an implementation that shares no code with Glyph, with repairs treated as failures and three negative controls that must fail. |
Why a converted CAD outline sometimes exposes nothing
A mask writer exposes regions — closed polygons with area. CAD outlines are frequently drawn as separate LINE, ARC and SPLINE entities that merely touch end to end, sometimes with a sub-micron gap. Converted literally, each becomes a zero-width path: a centreline, geometrically correct and completely non-exposing. The file opens cleanly, the picture looks right, and the mask comes out blank.
The close open contours & heal geometry option, checked by default, chains touching segments into closed rings, per (layer, datatype) pair and never across layers, with an endpoint tolerance that scales with the drawing (0.1 % of its diagonal, kept between 100 nm and 10 µm); it also merges duplicate/overlapping segments and drops zero-length remnants. A chain that still does not close is force-closed only when it encloses real area (default 10 µm²). Keying the decision on enclosed area rather than on gap size is what lets a sloppy gap in a genuine outline close while a leader line or centreline — open by nature, enclosing nothing — stays open instead of becoming a slit of exposed resist. Every removal is counted and reported: chains that stay open keep the paths they came from, but exact-duplicate and overlapping segments are merged away.
Why the scope is what it is
DWG and DXF share one entity model — a general drafting model with named layers, native arcs and floating-point coordinates in a user-chosen unit. Mask and lithography tooling wants something narrower: closed polygons, numbered layer and datatype pairs, and an exact integer unit. This converter re-models the drawing into that narrower form on the way through, which is precisely why the output is predictable for exposure and imprecise for drafting.
If your destination is a mask-layout flow rather than another CAD tool, DWG to GDSII skips the DXF hop entirely and is usually the better target. For the trade-offs between the drafting model and the mask model, see DXF vs GDSII.
Open it in the editor
Layer mapping, outline closure and a design-rule check are all worth doing before geometry reaches an exposure tool. Open in the free Glyph editor — nothing to install, and your files never leave your browser. See Layers and Design rule check.
Glyph is made by NANYTE. For where a finished layout goes next, read NANYTE's maskless lithography overview.
Frequently asked questions
Is this a general-purpose DWG to DXF converter?
No, and it is important to say so up front. This converter is scoped to mask and lithography geometry. Your DWG is decoded, re-modelled as mask geometry, and written back out as DXF containing only TEXT, LWPOLYLINE and INSERT entities. Arcs, circles, ellipses, splines, hatches and solids all arrive flattened to polylines. If you need the original entity types back, export DXF from the tool that wrote the DWG.
What drawing unit does the exported DXF use?
One drawing unit is exactly 1 nanometre, declared with $INSUNITS = 12 and $MEASUREMENT = 1 for metric. That is the unit convention mask and lithography tooling expects, and it makes every coordinate an exact integer.
Why are the layers named L1D0 instead of my original layer names?
Because the geometry passes through a mask-layout model, where a layer is a numbered layer and datatype pair. The DXF layer name encodes that pair, so layer 1 datatype 0 becomes L1D0. DXF has no datatype concept of its own, so without the convention two distinct mask layers would silently merge.
Which DWG versions can be read?
Containers from R14 through R2018 — AC1014, AC1015, AC1018, AC1021, AC1024, AC1027 and AC1032, including R2007 with its distinct page and compression scheme.
Why does my converted file expose nothing on the mask?
CAD outlines are often drawn as separate LINE and ARC entities that enclose no area, which become zero-width paths a mask writer treats as centrelines. The close-open-contours option, on by default, chains touching segments into closed rings first; untick it only to convert the file exactly as drawn.
Is there a file size limit?
The conversion runs inside your browser tab, so your machine's memory is the real ceiling. The converter checks the file size before parsing, warns above roughly 50 MB and declines files beyond roughly 200 MB rather than risking an out-of-memory crash.
Is my DWG file uploaded anywhere?
No. The DWG is decoded in your browser by a from-scratch reader that ships with the page. There is no server to upload to, and your design data never leaves your machine.