General Structure and Conventions

The circuit to be analyzed is described by a text file called a netlist. The first line in the netlist is ignored, that is, it is assumed to be a comment. The last line of the netlist is usually simply the line ".END", but this can be omitted. Any lines after the line ".END" are ignored.

LTspice can process three different encodings: Little-endian UTF-16 with or without byte order mark, UTF-8 with or without byte order mark, and Latin-1 (ISO 8859-1). Latin-1 encoding is only assumed if a file contains byte sequences that are invalid UTF-8. UTF-8 is the recommended encoding for LTspice, and is used exclusively by the built-in netlister. (Note: Non-ASCII netlists in UTF-8 encoding will not work as expected in older versions of LTspice that cannot decode UTF-8.) LTspice conforms to the Unicode standard version 14 and normalizes all its input. It compares text elements according to their canonical equivalence and uses Unicode case folding for case insensitivity. The LTspice netlist parser is based on grapheme clusters.

The order of the lines between the comment and end is irrelevant. Lines can be comments, circuit element declarations or simulation directives. Let's start with an example:

* This first line is ignored
* The circuit below represents an RC circuit driven
* with a 1MHz square wave signal
R1 n1 n2 1K ; a 1KOhm resistor between nodes n1 and n2
C1 n2 0 100p ; a 100pF capacitor between nodes n2 and ground
V1 n1 0 PULSE(0 1 0 0 0 .5μ 1μ) ; a 1Mhz square wave
.tran 3μ ; do a 3μs long transient analysis
.end

The first two lines are comments. Any line starting with a "*" is a comment and is ignored. The line starting with "R1" declares that there is a 1K resistor connected between nodes n1 and n2. Note that the semicolon, ";", can be used to start a comment in the middle of a line. The line starting with "C1" declares that there is a 100pF capacitor between nodes n2 and ground. The node "0" is the global circuit common ground.

Below is an overview of the lexicon of LTspice:

  • Leading spaces, blanks, and tabs are ignored.
  • Case is ignored (via Unicode case folding as mentioned above).
  • The first non-blank character of a line defines the type of circuit element.
Leading Character Type of line
* Comment
A Special function device
B Arbitrary behavioral source
C Capacitor
D Diode
E Voltage dependent voltage source
F Current dependent current source
G Voltage dependent current source
H Current dependent voltage source
I Independent current source
J JFET transistor
K Mutual inductance
L Inductor
M MOSFET transistor
O Lossy transmission line
Q Bipolar transistor
R Resistor
S Voltage controlled switch
T Lossless transmission line
U Uniform RC-line
V Independent voltage source
W Current controlled switch
X Subcircuit Invocation
Z MESFET or IGBT transistor
@ Frequency Response Analyzer
& Frequency Response Analysis Probe
. A simulation directive, For example: .options reltol=1e-4
+ A continuation of the previous line. The "+" is removed and the remainder of the line is considered part of the prior line.

Numbers can be expressed not only in scientific notation; e.g., 1e12; but also using engineering multipliers. That is, 1000.0 or 1e3 can also be written as 1K. Below is a table of understood multipliers:

Suffix Multiplier
T 1e12
G 1e9
Meg 1e6
K 1e3
mil 25.4e-6
m 1e-3
u(or μ) 1e-6
n 1e-9
p 1e-12
f 1e-15

The suffixes are not case sensitive. Unrecognized letters immediately following a number or engineering multiplier are ignored. Hence, 10, 10V, 10Volts, and 10Hz all represent the same number, and M, MA, MSec, and MMhos all represent the same scale factor (0.001). A common error is to draft a resistor with value of 1M, thinking of a one Megaohm resistor, however, 1M is interpreted as a one milliohm resistor. This is necessary for compatibility with standard SPICE practice.
The fact that unrecognized letters immediately following a number or engineering multiplier are ignored can lead to surprising errors. Consider this example:

C23 N1 N2 4Farads

This will create a capacitor with a capacitance of 4 femto farads, which is probably not intended. Therefore it is recommended not to use this feature. You can enforce this by enabling the option "reject_number_tails", which will make LTspice report any unrecognized letter as syntax error. Note though that this may break exisiting spice models.

LTspice will accept numbers written in the form 6K34 to mean 6.34K. This works for any of the multipliers above.

Node names may be arbitrary character strings. Global circuit common node (ground) is "0", though "GND" is special synonym. Note that since nodes are character strings, "0" and "00" are distinct nodes.

Throughout the following sections of the manual, angle brackets are placed around data fields that need to be filled with specific information; for example, "<srcname>" would be the name of some specific source. Square brackets indicate that the enclosed data field is optional. "|" denotes alternatives; for example "<subckt name>|<string expression>" means either a name or an expression in curly braces which yields a string.