.LIB — Include a Library
Syntax:
.lib <filename>
This directive includes the model and subcircuit definitions of the named file as if that file had been typed into the netlist instead of the .lib command. Circuit elements at global scope are ignored.
An absolute path name may be entered for the filename. Otherwise LTspice searches the following folders in order:
- The directory that contains the calling netlist
- The user libraries directory
- Any of the user specified library search paths
- %LOCALAPPDATA%\LTspice\lib\cmp *
- %LOCALAPPDATA%\LTspice\lib\sub *
* Do not edit ADI-provided files in %LOCALAPPDATA%\LTspice—these files may be overwritten or deleted when LTspice is updated.
No file name extension is assumed.
For example.
.lib "mypath to\myfile.lib"
Section syntax:
.lib 'filename' <entryname>
.lib "filename" <entryname>
This directive searches the file specified by filename for a section enclosed by:
.lib <entryname>
and
.endl
and only loads the contents in that section.
Encrypted Libraries
LTspice can generate and read a special form of encrypted libraries. This allows one user to prepare a library that another user can use in a simulation without revealing the implementation of the library. A reasonable attempt has been made to make the encrypted library difficult to decode by unauthorized concerns, but it cannot be considered perfectly secure if for no other reason than it is implemented in software.
To prepare an encrypted library, you need to invoke LTspice from the command line with the command line option "-encrypt". You will need to first backup the library because it will be replaced with the encrypted version. THERE EXISTS NO UTILITY TO CONVERT AN ENCRYPTED LIBRARY BACK TO CLEAR TEXT. Below summarizes the two steps:
- Make a backup copy of the library. The version you encrypt is deleted.
- From a command line, type
\ltspice.exe -encrypt < filename>
The file <filename> will be replaced with an encrypted version. The encryption process will take a few minutes.
One this process is finished, you have an encrypted ASCII file. It's possible to add a copyright notice above the "* Begin:" line, but the first 9 lines of the file must remain unchanged and each line of copyright notice you add must begin with the character '*'.
That is, here an encrypted file written by LTspice:
* LTspice Encrypted File
*
* This encrypted file has been supplied by a 3rd
* party vendor that does not wish to publicize
* the technology used to implement this library.
*
* Permission is granted to use this file for
* simulations but not to reverse engineer its
* contents.
*
* Begin:
50 3E 46 0F FA 6E 67 FF B8 4D D9 62 14 32 60 24
36 71 35 0B 66 4F AD 52 B8 F5 9E 22 9F C0 18 8B
FB FE 1D...
which you can change to
* LTspice Encrypted File
*
* This encrypted file has been supplied by a 3rd
* party vendor that does not wish to publicize
* the technology used to implement this library.
*
* Permission is granted to use this file for
* simulations but not to reverse engineer its
* contents.
*
* Copyright © 2005 Acme SPICE Modeling
* For additional information, see
* www.acmespicemodels.com
*
* Begin:
50 3E 46 0F FA 6E 67 FF B8 4D D9 62 14 32 60 24
36 71 35 0B 66 4F AD 52 B8 F5 9E 22 9F C0 18 8B
FB FE 1D...
Copyright © 1998–2025 by Analog Devices Inc. All Rights Reserved.