All guides

How to open an .s2p file

An .s2p file is a Touchstone file: plain text holding the S-parameters of a two-port network, measured or simulated, at a list of frequencies. Any text editor opens it. Reading it is the harder half — the file is a table of numbers, and what you almost always want is the curve.

The quickest way to see that curve, with nothing installed, is to drop the file into AskSNP and describe the plot you want in plain English. The rest of this page is what is actually in the file, and the four ways to open one.

What is inside an .s2p file

The 2 in .s2p is the number of ports. The same format covers one port (.s1p), four ports (.s4p) and beyond; only the number of columns changes.

A Touchstone file has three kinds of line.

  • Comments start with !. Instruments usually write the date, the model and the calibration state into them.
  • The option line starts with # and appears exactly once. It states the frequency unit, the parameter type, the number format and the reference impedance.
  • Data lines carry one frequency followed by the parameters at that frequency.

A typical option line reads # GHZ S DB R 50. That says: frequencies are in GHz, the parameters are S-parameters, each one is written as a magnitude in decibels followed by an angle in degrees, and the reference impedance is 50 ohms. Where a field is left out, the defaults are GHz, S-parameters, MA and 50 ohms.

The number format is the field to check first. DB is decibel-magnitude-and-angle, MA is linear-magnitude-and-angle, and RI is real-and-imaginary. All three describe the same complex number, and in both DB and MA the angle is in degrees.

The frequency unit lives in the option line and nowhere else. A column running from 1 to 10 is 1–10 GHz or 1–10 Hz depending on one word at the top of the file.

The column order that catches people out

A two-port data line holds nine numbers: the frequency, then four pairs. The pairs are in the order S11, S21, S12, S22 — not the reading order of the matrix.

That order is specific to two-port files. Touchstone files with three or more ports list their parameters row by row instead: S11, S12, S13, then S21, S22, S23, and so on. If you have ever written a reader that was right on an .s3p file and transposed on an .s2p, this is why.

Four ways to open one

1. A text editor, to see what you have

Open the file and read the first few lines. The option line gives you the units and the format, and the comments usually say what was measured. This is the right first move whenever a file refuses to load somewhere else.

2. A browser-based viewer, when you want the plot

AskSNP reads the file and plots what you ask for in plain English — “plot S21 magnitude in dB”, “show the VSWR for S11”, “overlay S11 and S22”. There is nothing to install and no account to create, which makes it the fastest route when the file arrived by email and you want to see the insertion loss now. The prompt cheatsheet has worked examples of the requests it understands.

3. Python, with scikit-rf

scikit-rf is the open-source RF library, and three lines get you a plot:

import skrf as rf

network = rf.Network('measurement.s2p')
network.plot_s_db(m=1, n=0)  # S21 in dB

Its port indices are zero-based, so m=1, n=0 is S21. network.f is the frequency axis in Hz whatever unit the file used, and network.s is the complex S-parameters as an array of frequency by port by port.

4. Your VNA software, or MATLAB

Every VNA vendor’s application opens Touchstone files, and so does every circuit simulator — that is what the format is for. If you have MATLAB with the RF Toolbox:

s = sparameters('measurement.s2p');
rfplot(s, 2, 1);

These are the right tools when you are going to do something with the data. They are the slow route when someone has just sent you a file.

What the four parameters mean

  • S11 is the reflection at port 1. In dB it is normally negative, and the return loss is the same number with the sign flipped: an S11 of -20 dB is 20 dB of return loss.
  • S21 is transmission from port 1 to port 2. For a passive component it is negative in dB, and the insertion loss is again the positive version of it.
  • S12 is transmission the other way. For a reciprocal component — a cable, a passive filter, a connector — it is equal to S21.
  • S22 is the reflection at port 2.

When the file will not open

  • More rows than you expected. A two-port Touchstone file may carry noise parameters after the S-parameter block. They are a separate table with a different number of columns, and it begins at a frequency lower than the last one above it.
  • Two option lines. There is only ever one. A file with two has been concatenated from two measurements and needs splitting.
  • Nine numbers expected, more found. The extension is a claim, not a guarantee. If a data line carries more than nine numbers, the file is not a two-port file whatever it is named.
  • Square-bracket keywords. A file with a [Version] 2.0 line is Touchstone 2.0, which adds keyword lines in square brackets and is usually named .ts. Older readers that only know Touchstone 1.x will reject it.

Last updated 2026-09-21.