I've used LTspice for a long time but I've never made a subckt. When I google "create a LTspice subckt from a txt file", there are no clear steps showing how to do it.

One post said to first change the .txt extension to .subckt then click on some pull-down menu which is in an old version of LTspice and no longer there.

Is there a simple 1,2,3 steps in how to do this?

What I have is a .txt file of a subckt. It's a 4 pin device with several MODELs and SUBCKTs within.


1 Answer 1


LTspice doesn't care about extensions. Whether the file is a .sub, or .lib, .cir, .txt, or even without extension, it reads the file and if the syntax inside is correct, it will use that file.

Therefore, if your .txt file is already a subcircuit, all you need to do is to add a relevant .lib line inside your schematic, while making sure that you spell the filename properly, say .lib /path/to/some/subcircuit.txt (as you probably know, Windows has a history of hiding extensions, unless manually set otherwise).

If all you need is one subcircuit out of that .txt file, the .lib command ensures that everything inside the file is available in the schematic (as long as everything obeys the syntax). Then simply use the name of the desired .subckt in a symbol of your choice (or a SPICE directive).

  • 1
    \$\begingroup\$ Thats assuming that the file with the arbitrarily named extension actually contains text with ANSI encoding \$\endgroup\$
    – Voltage Spike
    Commented Aug 26, 2020 at 17:08
  • \$\begingroup\$ @VoltageSpike It allows Unicode, too. But if it didn't, the characters that would have been read would have mingled the syntax (though I understand what you mean). \$\endgroup\$ Commented Aug 26, 2020 at 17:51
  • \$\begingroup\$ I searched and googled "add a relevant .lib line inside your schematic" and I have no explanation what that means. \$\endgroup\$
    – MrPWM
    Commented Aug 26, 2020 at 19:29
  • \$\begingroup\$ @MrPWM Inside the schematic, press S, type .lib /path/to/filename.txt, OK, then LClick to place in the schematic. If you don't know the location, just type .lib bla, place on the schematic, RClick on it to bring up the .lib/.inc editor, then browse for your file. However, if these steps are so new to you that you had to search for them, then you don't know the tool. You'd be better off searching for tutorials on how to use the tool before using it. It would save you from many frustrations about "why doesn't it work?" when the solution might be trivial, or even basic usage. \$\endgroup\$ Commented Aug 26, 2020 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.