Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

SPICE is a circuit simulator; a SPICE netlist, also called a deck, is the text file that tells it what components are connected, what values or models to use, and which calculations to perform. You can learn the workflow with ngspice: describe a small circuit, load the deck, run an analysis, inspect the result, and revise the file if needed.

What a SPICE netlist or deck contains

A deck describes a circuit as components connected through named nodes, along with component values or model references and simulation directives. SPICE implementations use related but not always identical syntax, so examples should be treated as specific to the simulator they target. Tony R. Kuphaldt’s reference chapter notes that “SPICE source files are commonly referred to as ‘netlists,’ although they are sometimes known as ‘decks’.” All About Circuits’ chapter on SPICE programming introduces the edit-and-rerun workflow.

Write a first ngspice deck

This ngspice example describes a 1 V source feeding two resistors in series. The output node is between a 1 kΩ resistor and a 2 kΩ resistor, with the second resistor connected to ground.

Voltage divider example
V1 in 0 DC 1
R1 in out 1k
R2 out 0 2k
.control
op
print out
.endc
.end
  • Title line: The first line names the deck. In this example it is “Voltage divider example.”
  • Element names and node order: Each component has a name and connection nodes. V1 connects between in and 0; R1 connects between in and out; R2 connects between out and 0.
  • Ground: Node 0 is the reference node in this ngspice deck.
  • Values: The source is set to 1 V DC, and the resistors are 1 kΩ and 2 kΩ.
  • Analysis and output: The .control section runs op, an operating-point analysis, and print out displays the voltage at the named node.
  • End markers: .endc closes the control section; .end ends the deck.

With these values, ngspice reports approximately 0.666667 V at out. This is the expected divider result for this example, not a guarantee about a physical circuit. The ngspice beginner tutorial demonstrates loading a deck and running analyses.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run the deck and inspect the result

Save the text as a file such as divider.cir, then load it in ngspice. In interactive use, the command is source divider.cir. The control section in the example runs the analysis and prints the output node voltage. When a run fails, read the simulator’s error message and check the element line, node names, values, directives, and simulator-specific syntax; edit the deck and rerun it.

The typical simulator workflow is to read and preprocess the netlist, build the circuit representation, run the requested calculation, and process results. The ngspice documentation index links to the version 47 manual and notes that its continuously updated manual is a work in progress; consult the manual matching the installed version for version-specific details.

Choose an analysis for the question

Analysis Question it answers What it represents
Operating point (op) What DC voltage and current state does the circuit settle into? A steady-state DC solution.
Transient How do voltages and currents change over time? Time-domain behavior, such as a response after a source changes.
AC How does the circuit respond across frequency? Small-signal frequency behavior around a bias point.

SPICE was developed for nonlinear DC and transient analyses and linear AC analysis. Berkeley’s overview describes supported element categories including passive components, sources, transmission lines, switches, and common semiconductor devices. See the Berkeley SPICE documentation for foundational scope and Spice3f references.

Choose how to run repeat simulations

Once a single deck works, select a run mode based on how much interaction and repeat processing you need. The ngspice control-language tutorial explains interactive use, batch runs, and control sections.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Mode Best suited to How it helps
Interactive Learning commands and exploring a circuit Load a deck, issue commands, and inspect results in a session.
Batch Unattended or repeatable runs Run a deck without interactive command entry and save simulation output to a file.
Control section Sequences of analyses and result handling Automate repeated simulations, loops, processing, plots, and saved data.

Check portability before moving a deck

“SPICE” refers to a family of related simulator implementations, not a promise that every deck behaves identically everywhere. Implementations have accumulated different syntax and behavior, and models may depend on simulator-specific support. ngspice documents compatibility modes for dialects including LTspice, PSpice, HSPICE, and KiCad, but a compatibility setting does not remove the need to check the target simulator’s manual and model requirements. The ngspice user manual discusses compatibility settings and dialect differences.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Interpret simulation results in context

A successful parse only shows that the simulator accepted the deck; it does not prove that a real circuit will behave identically. Results depend on the circuit description, model assumptions, and requested analysis. Check that component values and model parameters fit the design context, and compare simulated behavior with the information available about the actual circuit. The reviewed simulator documentation describes netlists and models as simulation inputs but does not establish a universal accuracy figure.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.