Arduino finds libraries in specific folders on your computer, and you can add new search locations through the IDE settings
When you write code in the Arduino IDE and include a library with a statement like #include <Wire.h>, the IDE searches for that library file in a fixed set of directories. By default, Arduino looks in the sketchbook folder (usually Documents/Arduino on Windows or Mac, or ~/Arduino on Linux) and in the IDE's built-in libraries folder. If your library is somewhere else, you need to tell Arduino where to find it.
You have three main ways to do this: move the library to a folder Arduino already searches, add a new search path through the IDE preferences, or use the full file path directly in your code. The method you choose depends on whether you want the library available for all your projects or just one sketch.
Key Takeaways
- Arduino searches for libraries in your sketchbook folder and the IDE's built-in libraries folder by default.
- The simplest solution is to place your library in the libraries subfolder inside your sketchbook directory.
- You can add additional library search paths by editing the preferences.txt file in your Arduino configuration folder.
- Using the full file path in your include statement works for single sketches but is not portable across computers.
Finding your sketchbook folder and the default library location
Your sketchbook folder is where Arduino stores all your sketches and looks for libraries by default. To find it, open the Arduino IDE, go to File > Preferences (on Windows and Linux) or Arduino > Preferences (on Mac). The first field shows your sketchbook location. Inside that folder, create a subfolder called libraries if it does not already exist.
Any library you place in sketchbook/libraries will be found automatically the next time you restart the IDE. This is the fastest way to make a library available. The IDE also searches its own installation folder for built-in libraries like Wire, SPI, and Serial, but you should not put your own libraries there because they will be lost if you reinstall Arduino.
Moving a library to the libraries folder
A library in Arduino is a folder containing a file named library.properties (or just the source files in older libraries). To install it, copy the entire library folder into your sketchbook/libraries directory. For example, if your library is called MyLibrary, the path should look like: Documents/Arduino/libraries/MyLibrary on Windows, or ~/Arduino/libraries/MyLibrary on Mac and Linux.
After you copy the library, restart the Arduino IDE completely. When you reopen it, the library will appear in the Sketch > Include Library menu. You can now include it in your code with #include <MyLibrary.h>. This method works across all your sketches and is the standard way most people manage libraries.
Adding a custom library search path in preferences
If you want to keep a library in a different location and have Arduino find it there, you can add that path to the IDE's search list. Close the Arduino IDE, then navigate to your Arduino configuration folder. On Windows, this is usually %APPDATA%/Arduino. On Mac, it is ~/Library/Arduino. On Linux, it is ~/.arduino15. Inside this folder, open the file preferences.txt in a text editor.
Look for the line that starts with sketchbook.path. Below it or on a new line, add: sketchbook.additional.libraries.folders=/path/to/your/library/folder. Replace /path/to/your/library/folder with the actual full path to the folder containing your libraries. Use forward slashes even on Windows. Save the file, restart the IDE, and Arduino will now search that folder for libraries.
You can add multiple custom paths by separating them with commas. This approach is useful if you organize libraries in a central location outside your sketchbook, or if you share libraries across multiple Arduino installations on the same computer.
Using the full file path in your include statement
If you only need a library for one sketch, you can include it using its full file path instead of moving it. Replace #include <LibraryName.h> with #include "/full/path/to/library/header.h". Use double quotes instead of angle brackets, and provide the complete path from your drive root.
This method works but is not recommended for shared code or projects you plan to move to another computer. The path will break if you move the library or open the sketch on a different machine. It is useful only for temporary testing or when you have a specific reason to keep a library outside the standard locations.
Checking if Arduino found your library
After placing a library where Arduino should find it, restart the IDE and go to Sketch > Include Library. Scroll through the list to see if your library appears. If it does not, the library folder may be in the wrong location, or the IDE may not have restarted fully. Close the IDE completely (not just the window) and open it again.
If the library still does not appear, check that the folder structure is correct. The library folder itself should contain either a library.properties file or a .h header file. If you see an error like "fatal error: MyLibrary.h: No such file or directory" when you try to compile, the IDE did not find the library. Double-check the folder path and restart the IDE once more.
Organizing multiple libraries in your sketchbook
As you collect more libraries, keeping them organized in your sketchbook/libraries folder prevents confusion. Create subfolders by category if you want — for example, libraries/Sensors, libraries/Communication, libraries/Display. Arduino will search one level deep in the libraries folder, so this organization works without extra configuration.
If you download a library as a ZIP file, extract it first. The extracted folder is what you move into your libraries directory, not the ZIP file itself. Many libraries come with example sketches in an examples subfolder; these appear in File > Examples after you install the library correctly.
Frequently Asked Questions
What is the difference between angle brackets and double quotes in include statements?
Angle brackets like #include <Wire.h> tell Arduino to search in the standard library paths. Double quotes like #include "MyLibrary.h" tell it to search in the current sketch folder first, then the standard paths. Use angle brackets for installed libraries and double quotes for libraries in your sketch folder.
Can I have the same library in multiple locations?
Yes, but Arduino will use the first one it finds based on the search order: current sketch folder, sketchbook/libraries, custom paths in order, then built-in libraries. If you have duplicates, keep only one to avoid confusion and version conflicts.
Why does my library still not show up after I moved it?
The most common reason is that the IDE did not fully restart. Close it completely, wait a few seconds, and reopen it. Also check that the library folder is directly inside libraries, not nested deeper, and that it contains a .h header file or library.properties file.
Do I need to restart Arduino every time I add a library?
Yes. The IDE reads the library list when it starts, so it will not see new libraries until you restart. This applies whether you move a library to the libraries folder or add a new search path.
What if I want to use a library that is still being developed?
You can point Arduino to the development folder directly by adding its path to preferences.txt as a custom library search folder. This way, any changes you make to the library files are immediately available without copying files around.