LTspice
Introduction
LTspice (by Analog Devices, formerly Linear Technology) is a SPICE simulation tool for analog circuit design. KiCad provides a schematic-only importer for LTspice files (LTspice has no layout capability).
Supported file types:
-
.asc— LTspice schematic (the import entry point) -
.asy— LTspice symbol definition (consumed during import to reconstruct component graphics and pin definitions)
Both file types are plain text, line-oriented formats. Each line begins with an uppercase keyword followed by space-separated parameters. The parser splits lines on spaces and reconstructs multi-word values (such as SYMATTR values containing spaces) by concatenating all tokens from the value position onward. Files may use either LF or CR+LF line endings; trailing carriage returns are stripped during parsing.
Schematic Format (.asc)
An .asc file describes one schematic sheet. It contains a header declaring the
version and sheet dimensions, followed by an unordered sequence of element lines.
Keywords
| Keyword | Description |
|---|---|
VERSION |
File format version number |
SHEET |
Sheet number and dimensions |
SYMBOL |
Component instance placement |
WIRE |
Electrical connection between two points |
FLAG |
Net label or power symbol |
DATAFLAG |
Data expression marker attached to a wire |
LINE |
Graphical line |
CIRCLE |
Graphical circle |
ARC |
Graphical arc |
RECTANGLE |
Graphical rectangle |
TEXT |
Text annotation or SPICE directive |
WINDOW |
Attribute display position override (follows a SYMBOL) |
SYMATTR |
Symbol attribute value override (follows a SYMBOL) |
IOPIN |
Hierarchical I/O pin marker |
BUSTAP |
Bus tap connection |
VERSION
Declares the file format version.
VERSION <version>
The version may be an integer (4) or a dotted pair (4.1). When a dot is present,
the major and minor parts are parsed separately.
SHEET
Declares the sheet number and drawing area size.
SHEET <sheet_number> <width> <height>
All three parameters are integers. The width and height define the drawing area in LTspice coordinate units.
SYMBOL
Places a component instance on the schematic.
SYMBOL <name> <x> <y> <orientation>
| name |
Symbol name or library-relative path. Backslashes in the name are converted to
forward slashes for cross-platform path resolution (e.g., |
| x, y |
Placement position in LTspice coordinates. |
| orientation |
One of the eight orientation values. |
After a SYMBOL line, any number of WINDOW and SYMATTR lines may follow. These modify the most recently declared symbol.
WIRE
Defines an electrical connection between two points.
WIRE <x1> <y1> <x2> <y2>
All four parameters are integer coordinates.
FLAG
Places a net label at a point.
FLAG <x> <y> <name>
A FLAG with the name 0 is converted to a GND power symbol during import. All other
names become global labels. The font size defaults to 2.
DATAFLAG
Places a data expression marker.
DATAFLAG <x> <y> <expression>
Data flags are imported as directive labels. The font size defaults to 2.
LINE
Draws a graphical line on the schematic.
LINE <line_width> <x1> <y1> <x2> <y2> [<line_style>]
| line_width |
|
| x1, y1 |
Start point. |
| x2, y2 |
End point. |
| line_style |
Optional integer, defaults to 0. See Line Style Values. |
CIRCLE
Draws a graphical circle. The circle is defined by its bounding rectangle.
CIRCLE <line_width> <x1> <y1> <x2> <y2> [<line_style>]
| line_width |
|
| x1, y1 |
First corner of the bounding rectangle. |
| x2, y2 |
Opposite corner of the bounding rectangle. |
| line_style |
Optional integer, defaults to 0. See Line Style Values. |
The center is computed as ((x1+x2)/2, (y1+y2)/2) and the radius as (x1-x2)/2.
ARC
Draws a graphical arc. The arc is inscribed in a bounding rectangle, with explicit start and end points that lie on the arc. The arc is drawn counterclockwise from the start point to the end point.
ARC <line_width> <x1> <y1> <x2> <y2> <start_x> <start_y> <end_x> <end_y> [<line_style>]
| line_width |
|
| x1, y1 |
First corner of the bounding rectangle. |
| x2, y2 |
Opposite corner of the bounding rectangle. |
| start_x, start_y |
Arc start point. |
| end_x, end_y |
Arc end point. |
| line_style |
Optional integer, defaults to 0. See Line Style Values. |
In .asc files the parser swaps start and end points: the token labeled "start"
in the file is stored as the arc end, and vice versa. This does not occur in
.asy files.
|
RECTANGLE
Draws a graphical rectangle.
RECTANGLE <line_width> <x1> <y1> <x2> <y2> [<line_style>]
| line_width |
|
| x1, y1 |
First corner. |
| x2, y2 |
Opposite corner. |
| line_style |
Optional integer, defaults to 0. See Line Style Values. |
TEXT
Places a text annotation or SPICE directive.
TEXT <x> <y> <justification> <font_size> <value>
| x, y |
Text position. |
| justification | |
| font_size |
Integer font size (1—7). |
| value |
The text content. Multi-word values span to the end of the line. |
Text values use prefix characters to indicate SPICE directives versus comments:
-
Values starting with
!are SPICE directives. The leading!is stripped and subsequent `! ` sequences are converted to line breaks. -
Values starting with
;are comments. The leading;is stripped and subsequent `; ` sequences are converted to line breaks. -
The escape sequence
\nis converted to a line break in all cases.
WINDOW
Overrides the display position of a symbol attribute field. Must follow a SYMBOL line.
WINDOW <number> <x> <y> <justification> <font_size>
| number |
Window number identifying which attribute field to position. See Window Number Mappings. |
| x, y |
Display position relative to the symbol origin. |
| justification | |
| font_size |
Integer font size. A font size of 0 hides the field. |
If a WINDOW line in an .asc file specifies a window number that already exists in
the symbol’s .asy definition, the .asc values override the .asy values.
SYMATTR
Sets a symbol attribute value. Must follow a SYMBOL line.
SYMATTR <key> <value>
The key is stored in uppercase. The value spans to the end of the line. A value of
"" (two double-quote characters) is treated as an empty string.
See SYMATTR Keys for known attribute keys.
IOPIN
Marks a hierarchical I/O pin location.
IOPIN <x> <y> <polarity>
| polarity |
One of |
IOPINs are matched to FLAG elements at the same coordinates to determine the pin name. The matched FLAG is consumed and not imported as a separate net label.
BUSTAP
Defines a bus tap connection.
BUSTAP <x1> <y1> <x2> <y2>
Wires connected to the bus tap’s start point are promoted to the bus layer.
Orientation Encoding
Symbols can be placed in eight orientations, combining rotation and mirror operations. The orientation value appears as the last parameter of a SYMBOL line.
| Value | Rotation | Mirror | KiCad Transformation |
|---|---|---|---|
R0 |
0deg |
No |
No transformation |
R90 |
90deg CW |
No |
Rotate 180deg then rotate 90deg CCW |
R180 |
180deg |
No |
Rotate 180deg |
R270 |
270deg CW |
No |
Rotate 90deg CCW |
M0 |
0deg |
Yes |
Mirror about Y axis |
M90 |
90deg CW |
Yes |
Mirror about Y axis then rotate 90deg CCW |
M180 |
180deg |
Yes |
Mirror about X axis |
M270 |
270deg CW |
Yes |
Mirror about Y axis then rotate 90deg CW |
Justification Encoding
Text and window positions use justification strings to control alignment and orientation. The "V" prefix indicates vertical (90deg) text.
| Value | Horizontal Align | Vertical Align | Text Angle |
|---|---|---|---|
Left |
Left |
Center |
Horizontal |
Center |
Center |
Center |
Horizontal |
Right |
Right |
Center |
Horizontal |
Top |
Center |
Top |
Horizontal |
Bottom |
Center |
Bottom |
Horizontal |
VLeft |
Left |
Center |
Vertical |
VCenter |
Center |
Center |
Vertical |
VRight |
Right |
Center |
Vertical |
VTop |
Center |
Top |
Vertical |
VBottom |
Center |
Bottom |
Vertical |
Invisible |
— |
— |
Hidden |
For multiline text, horizontal justification modes (Left, Center, Right) force vertical alignment to Top with a half-line-height offset. Vertical text modes (VLeft, VCenter, VRight) apply the same adjustment on the horizontal axis.
Pin justification uses a subset of these values (Left, Right, Top, Bottom, None and their vertical variants). The pin justification determines pin orientation during import: Left maps to pin pointing right, Right to left, Bottom to up, Top to down. A justification of None hides the pin name.
Line Style Values
Graphical elements (LINE, CIRCLE, ARC, RECTANGLE) accept an optional line style integer.
| Value | Style |
|---|---|
0 |
Solid (default) |
1 |
Dash |
2 |
Dot |
3 |
Dash-dot |
4 |
Dash-dot-dot |
Line Width Values
| Value | Width |
|---|---|
Normal |
5 units (default) |
Wide |
10 units |
KiCad maps Normal to 6 mils and Wide to 12 mils stroke width.
Symbol Format (.asy)
An .asy file defines the graphical appearance and pin layout of a single LTspice
symbol. The file shares many keywords with the .asc format but adds pin and symbol
type definitions.
Keywords
| Keyword | Description |
|---|---|
LINE |
Graphical line (same syntax as |
RECTANGLE |
Graphical rectangle (same syntax as |
CIRCLE |
Graphical circle (same syntax as |
ARC |
Graphical arc (same syntax as |
WINDOW |
Attribute display position |
SYMATTR |
Symbol attribute definition |
PIN |
Pin definition |
PINATTR |
Pin attribute (follows a PIN) |
SYMBOLTYPE |
Symbol type declaration |
PIN
Defines a symbol pin.
PIN <x> <y> <justification> <name_offset>
| x, y |
Pin location in symbol coordinates. |
| justification |
Pin orientation and name visibility. See Justification Encoding. |
| name_offset |
Integer offset for the pin name text. |
After a PIN line, any number of PINATTR lines may follow to set pin attributes.
PINATTR
Sets an attribute on the most recently declared pin.
PINATTR <name> <value>
The value spans to the end of the line. Common pin attributes:
| Attribute | Description |
|---|---|
PinName |
Display name for the pin |
SpiceOrder |
Pin order in SPICE netlist |
SYMBOLTYPE
Declares the symbol category.
SYMBOLTYPE <type>
| Value | Description |
|---|---|
Cell |
Standard component symbol (default) |
Block |
Block diagram or subcircuit symbol |
Window Number Mappings
Window numbers identify which attribute field a WINDOW line positions. The importer maps a subset of these to KiCad fields; unmapped numbers are recognized but ignored.
| Number | Attribute Name | KiCad Field Mapping |
|---|---|---|
-1 |
PartNum |
— |
0 |
InstName |
Reference |
1 |
Type |
— |
2 |
RefName |
— |
3 |
Value |
Value |
5 |
QArea |
— |
8 |
Width |
— |
9 |
Length |
— |
10 |
Multi |
— |
16 |
Nec |
— |
38 |
SpiceModel |
Sim.Name |
39 |
SpiceLine |
Sim.Params |
40 |
SpiceLine2 |
— |
47 |
Def_Sub |
— |
50 |
Digital_Timing_Model |
— |
51 |
Digital_Extracts |
— |
52 |
Digital_IO_Model |
— |
53 |
Digital_Line |
— |
54 |
Digital_Primitive |
— |
55 |
Digital_MNTYMXDLY |
— |
56 |
Digital_IO_LEVEL |
— |
57 |
Digital_StdCell |
— |
58 |
Digital_File |
— |
105 |
Cell |
— |
106 |
W/L |
— |
107 |
PSIZE |
— |
108 |
NSIZE |
— |
109 |
sheets |
— |
110 |
sh# |
— |
111 |
Em_Scale |
— |
112 |
Epi |
— |
113 |
Sinker |
— |
114 |
Multi5 |
— |
118 |
AQ |
— |
119 |
AQSUB |
— |
120 |
ZSIZE |
— |
121 |
ESR |
— |
123 |
Value2 |
— |
124 |
COUPLE |
— |
125 |
Voltage |
— |
126—129 |
Area1—Area4 |
— |
130—133 |
Multi1—Multi4 |
— |
134 |
DArea |
— |
135 |
DPerim |
— |
136 |
CArea |
— |
137 |
CPerim |
— |
138 |
Shrink |
— |
139 |
Gate_Resize |
— |
142 |
BP |
— |
143 |
BN |
— |
144 |
Sim_Level |
— |
146 |
G_Voltage |
— |
150 |
SpiceLine3 |
— |
153 |
D_VOLTAGES |
— |
156 |
Version |
— |
157 |
Comment |
— |
158 |
XDef_Sub |
— |
159 |
LVS_Area |
— |
162—166 |
User1—User5 |
— |
167 |
Root |
— |
168 |
Class |
— |
169 |
Geometry |
— |
170 |
WL_Delimiter |
— |
175 |
T1 |
— |
176 |
T2 |
— |
184 |
DsgnName |
— |
185 |
Designer |
— |
190 |
RTN |
— |
191 |
PWR |
— |
192 |
BW |
— |
201 |
CAPROWS |
— |
202 |
CAPCOLS |
— |
203 |
NF |
— |
204 |
SLICES |
— |
205 |
CUR |
— |
206 |
TEMPRISE |
— |
207 |
STRIPS |
— |
208 |
WEM |
— |
209 |
LEM |
— |
210 |
BASES |
— |
211 |
COLS |
— |
212 |
XDef_Tub |
— |
| Only window numbers 0, 3, 38, and 39 are actively mapped to KiCad fields. All other window numbers are parsed without error but have no effect on the imported schematic. |
SYMATTR Keys
SYMATTR lines set key-value attributes on symbols. Keys are stored in uppercase internally. The following keys are used during import:
| Key | Description |
|---|---|
InstName |
Reference designator (mapped to KiCad Reference field) |
Value |
Component value (mapped to KiCad Value field) |
Value2 |
Secondary value (used as fallback or appended to simulation model) |
Prefix |
SPICE netlist prefix character (R, C, L, X, etc.) |
Type |
Device type for semiconductor model lookup |
Description |
Component description text |
SpiceLine |
SPICE parameter string (mapped to Sim.Params) |
SpiceLine2 |
Additional SPICE parameters |
ModelFile |
Path to external SPICE model file (mapped to Sim.Library) |
The Prefix attribute has special significance for hierarchical design detection:
a symbol whose .asy file lacks a Prefix attribute is treated as a sub-schematic
rather than a component.
Coordinate System
LTspice uses an integer coordinate system with Y increasing downward. The coordinate scaling formula used during import is:
kicad_coord = MilsToIU( rescale( 50, ltspice_coord, 16 ) )
This maps 16 LTspice units to 50 mils (1.27 mm) in KiCad’s internal coordinate space. The inverse transform is:
ltspice_coord = IUToMils( rescale( 16, kicad_coord, 50 ) )
Page Centering
After converting all coordinates, the importer centers the design on the KiCad page. It computes a bounding box of all elements and offsets them to center on the page, clamping to a 10-grid margin if the design exceeds page dimensions. The offset snaps to a 50-mil grid.
Font Size Mapping
LTspice font sizes (1—7) map to KiCad text sizes in mils:
| LTspice Size | KiCad Mils |
|---|---|
1 |
36 |
2 |
42 |
3 |
50 |
4 |
60 |
5 |
72 |
6 |
88 |
7 |
108 |
A font size of 0 in a WINDOW definition within an .asy file is treated as size 2
(LTspice appears to ignore the hidden property from .asy files). A font size of 0
in an .asc WINDOW override hides the field.
SPICE Simulation Mapping
The importer translates LTspice component attributes into KiCad simulation fields
(Sim.Device, Sim.Params, Sim.Library, Sim.Name, Sim.Type) based on the
symbol’s Prefix attribute.
| Prefix | Sim.Device | Behavior |
|---|---|---|
R |
R |
Non-inferred passive; |
C |
C |
Non-inferred passive; |
L |
L |
Non-inferred passive; |
E, F, G, H |
(prefix) |
Controlled source; |
B |
V or I |
Behavioral source; device is V for symbols starting with |
T |
TLINE |
Transmission line; value is passed directly as |
V, I |
SPICE |
Voltage/current source with |
X |
SUBCKT |
Subcircuit; SpiceLine becomes |
(other) |
SPICE |
Generic SPICE device with model library lookup |
For generic SPICE devices, the importer resolves model libraries from:
-
The
ModelFilesymbol attribute -
The
Typeattribute matched against standard library files (standard.dio,standard.bjt,standard.jft,standard.mos) -
Include paths discovered from
.include,.inc, and.libSPICE directives in TEXT elements
Hierarchical Design Detection
A symbol is treated as a hierarchical sub-schematic when its .asy file does not
contain a SYMATTR Prefix line. The absence of a Prefix attribute signals that the
symbol represents a sub-circuit sheet rather than a component.
When a sub-schematic is detected:
-
A corresponding
.ascfile is loaded as a child sheet. -
The symbol graphics from the
.asyfile are drawn directly on the parent sheet (not as a KiCad symbol), and a KiCad sheet object is sized to match. -
IOPIN elements in the
.ascfile become hierarchical labels. -
Wires connecting to sub-schematic pin locations are adjusted to connect to the sheet boundary.
Imported Elements
-
Component instances with position, orientation (8-way rotation/mirror), and attribute overrides from WINDOW and SYMATTR lines
-
Symbol graphics (lines, rectangles, circles, arcs) from
.asyfiles with line style and width mapping -
Pins with name, position, and orientation from
.asydefinitions -
Wires as electrical connections between two points
-
Net labels from FLAG elements (with
0converted to GND power symbol) -
Data expression markers from DATAFLAG elements as directive labels
-
Bus taps with wire-to-bus layer promotion
-
Text annotations and SPICE directives with font size mapping and multiline support
-
SPICE simulation fields (Sim.Device, Sim.Params, Sim.Library, Sim.Name, Sim.Type) derived from Prefix, Value, SpiceLine, ModelFile, and Type attributes
-
Hierarchical sub-schematics detected by the absence of a Prefix attribute, with IOPIN elements converted to hierarchical labels
-
Page centering with bounding box calculation and 50-mil grid snapping
Limitations
-
Custom LTspice symbol search paths are not supported.
-
Only global labels and directive labels are implemented; other label types are not handled.
-
Hierarchical sheet pin placement on sheet boundaries is not functional.
-
Many window number types are recognized but not mapped to KiCad fields (see the full window number table).
-
All pins are created as passive type regardless of actual pin function.
-
Window numbers outside the known set are silently ignored.
Undocumented Areas
-
The complete set of SYMBOLTYPE values beyond
CellandBlockis unknown. -
The purpose of dotted-pair version numbers (e.g.,
4.1vs4) is unclear.