Convert SVG to GDSII
SVG-to-GDSII conversion turns a vector drawing into mask geometry: each filled path becomes a GDS boundary polygon, curves are flattened to polylines, and the drawing's fill colours are recovered as numbered GDS layers. The conversion runs entirely inside your browser — the file is parsed and written locally, and there is no server to upload it to.
How to convert SVG to GDSII
- Drop your
.svgfile onto the converter on this page. - Pick GDSII as the target format. Adjust the curve tolerance if you want finer or coarser flattening than the default.
- Download the
.gdsfile. Open it in the free Glyph editor to set the real-world scale, remap layers, and check that every intended region is a closed polygon.
What survives and what changes
| Aspect | What happens |
|---|---|
| Path data | The full d= grammar is read — M/m L/l H/h V/v C/c S/s Q/q T/t A/a Z/z — by a real number scanner, so sign-as-separator (c-3.4,0-6.2), forms like .5.5, exponents like 1e-3 and packed arc flags all parse correctly. Arcs go through the SVG endpoint-to-centre parameterisation. |
| Curves | Flattened to polylines with a tolerance relative to each curve's own control-point extent (0.002 of it, with an absolute floor so a degenerate curve still terminates). A caller-supplied tolerance is clamped to a safe range. |
| Scale | Coordinates are read as viewBox units and treated as world nanometres at whatever scale the SVG specified. SVG has no $INSUNITS equivalent, so re-scale in the editor if physical size matters. |
| Y axis | A root flip derived from the viewBox converts y-down SVG into y-up world space. It cancels Glyph's SVG writer's own flip exactly, so a Glyph → SVG → Glyph trip is position-exact. |
| Layers | Recovered from paint: a shape's key colour is its fill, or its stroke when the fill is none or absent. Distinct normalised colours become layers numbered contiguously from 1 in first-seen order. |
| Layer ceiling | Past 32 distinct colours the colour split is abandoned entirely and everything lands on layer 1 — predictable beats 32 arbitrary buckets. All shapes always land on a layer that exists in the document. |
| Stroke width | A missing stroke-width is treated as 0, not SVG's default of 1, so a zero-width centreline does not become a 1 nm ribbon. vector-effect="non-scaling-stroke" is treated as 0 for the same reason. |
| CSS | A deliberate subset, resolved in true cascade order (presentation attribute < author <style> rule < inline style=""), with type, .class and #id selectors including comma-separated lists and id > class > type specificity. |
| CSS out of scope | Combinators, attribute selectors, pseudo-classes and @media are dropped, counted and reported once — never guessed at. |
| Text | An SVG <text> element imports as a GDS text label. It deliberately carries no presentation or font-family, which is what makes the anchor round-trip in place. |
| Not imported | <image> elements (raster payload, no GDS primitive), and the non-rendered subtrees <defs>, <clipPath>, <mask>, <symbol>, <marker> and <pattern>, which are skipped whole — their content was never visible, so importing it would fabricate exposable geometry. |
| Degenerate | A shape whose points are all identical is dropped: it is invisible, unselectable, encloses no area, and would only inflate shape counts against what a writer actually prints. |
| Datatype | Every imported shape lands on datatype 0. Assign the pairs your process needs in the editor. |
Why an SVG is not already a mask
SVG describes appearance: strokes, fills, gradients, clip paths, opacity. GDSII describes exposable regions on numbered process layers. Three differences do most of the work in this conversion, and each is worth checking after you convert:
- A stroke is not a region. An outline drawn as a hairline stroke has no area. It converts to a zero-width GDS path, which a mask writer treats as a centreline. If a shape should expose, it needs a fill in the source or a width assigned afterwards.
- Colour is a proxy for layer, not a layer. The importer recovers layers from paint because that is the only signal an SVG carries. Two process layers drawn in the same colour arrive merged; two shades of the same intent arrive split.
- There is no unit. Nothing in the file states how big the drawing is meant to be, so the scale is your decision, made once in the editor.
For the reverse direction and the mapping in detail, see GDSII to SVG and convert GDSII to SVG. If your source is a raster image rather than a vector file, follow the image to GDSII guide instead. For the destination format's record structure, see the GDSII file format reference.
Open it in the editor
Setting the scale, remapping colour-derived layers onto process layers, and closing outlines are all editor work. Open in the free Glyph editor — nothing to install, and your files never leave your browser. See Layers and Modify shapes.
Glyph is made by NANYTE. For where a finished layout goes next, read NANYTE's maskless lithography overview.