.LIB

LIB File

Static / Import Library (COFF)
Ask a question
QUICK ANSWER

A .lib file is a compiler library consumed by the linker when building C/C++ programs on Windows. It is either a static library (compiled object code baked into your program) or an import library (stubs that connect your program to a DLL at run time). You do not open or run a .lib - the build system uses it. To inspect one, run lib /list or dumpbin /symbols from a Visual Studio Developer Command Prompt.

Developer: Microsoft (with Unix ar lineage) Category: Developer Files Open standard MIME: application/octet-stream
OPENS ON Windows Linux
Related: .DO · .MD · .HEX · .XSD

On this page

19k+ extensions indexed
Last reviewed Jun 24, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the LIB file format?

A .lib file is a library file provided as an input to the linker. .lib files come in two kinds: standard static library files and COFF (Common Object File Format) import library files. The static library files contain compiled .obj object modules; the import library files contain symbol and ordinal stubs pointing to a .dll, giving the linker the information it needs to resolve run-time dependencies. The LIB.EXE tool is used to create both types of library file. At the binary level, a .lib is an ar-format archive that starts with the 8-byte !<arch> signature - the same structure used by Unix .a static libraries. You can inspect the contents with DUMPBIN /HEADERS or ar -t.

Security & safety

RISK: LOW

A .lib is build-time data, not something Windows runs, so it poses little direct risk to end users. For developers the concern is supply-chain trust: a malicious or tampered static library links its code straight into your program, so only use .lib files from trusted SDK sources and verify checksums/signatures. The unrelated game/app .lib archives are inert data files.

Format details

in a nutshell
FULL NAMEStatic / Import Library (COFF)
DEVELOPERMicrosoft (with Unix ar lineage)since COFF lineage from Unix (1980s); MS .lib via Visual C++/MS-DOS toolchains, early 1990s
MIME TYPEapplication/octet-stream
TYPELibrary archive of COFF object files (static lib) or import stubs (import lib)
STANDARDOpen · royalty-free
This extension is also used by…
  • Game / application archive (LIB) - Some games and apps (e.g. certain titles' asset packs) use .lib as a custom data/archive container unrelated to compiler libraries.
MAGIC BYTES · FILE SIGNATURE
OFFSET
0001020304050607
HEX
213C617263683E0A
ASCII
!<arch>·
A Windows/COFF .lib is an ar-format archive, so it starts with the 8-byte "!<arch>\n" signature (same family as Unix .a static libraries). The contained members are COFF object files. Note: some other products (e.g. a few games and apps) reuse the .lib extension for unrelated data - those won't have this header.

Programs that open LIB files

Windows3 apps
Microsoft Visual Studio Freemium Add the .lib to a project's Linker > Input > Additional Dependencies; build to link against it. It isn't 'opened' on its own.
7-Zip Open-source Open the .lib as an archive to browse/extract its COFF object members (it's an ar archive).
LIB / DUMPBIN (MSVC tools) Built-in From a Developer Command Prompt: 'lib /list file.lib' to list members, or 'dumpbin /symbols file.lib' to see symbols.
Linux1 app
binutils (ar / nm) Open-source 'ar t file.lib' lists members; 'nm file.lib' lists symbols (works on ar-format libs including MSVC .lib).

Technical details

deep spec
Format typeArchive of COFF object modules (static lib) or import stubs (import lib)
Magic bytes21 3C 61 72 63 68 3E 0A - ASCII "!<arch>\n" at byte offset 0
Container structurear archive format; same 8-byte signature family as Unix .a static libraries
MIME typeapplication/octet-stream
Static lib contentsCOFF .obj members containing compiled machine code, relocation records, and symbol tables
Import lib contentsSymbol name table, DLL name, and export ordinal/name stubs - no executable machine code
Primary useLinker input: consumed by LINK.EXE or ld to resolve symbol references at build time
Creator toolLIB.EXE (MSVC toolchain); also ar and dlltool (GNU Binutils / MinGW)
Inspection toolsDUMPBIN.EXE /HEADERS, LIB.EXE /LIST, ar -t, nm
Symbol indexFirst archive member is a symbol map enabling fast symbol lookup during linking
Import lib generationAuto-generated by LINK.EXE when building a DLL; manually created with LIB.EXE /DEF:<deffile>
Linker compatibilityMicrosoft LINK.EXE, lld-link (LLVM); GNU ld via MinGW with partial compatibility
Target platformPrimarily Windows (Win32 / Win64); legacy MS-DOS toolchains
EncodingBinary; COFF records are machine-word aligned inside ar archive members
Unix counterpartUnix/Linux .a static library archive, created with ar and consumed by ld
Developer lineageMicrosoft implementation of COFF; COFF itself traces to AT&T Unix System V (1983)
ReleasedCOFF lineage from Unix (1980s); MS .lib via Visual C++/MS-DOS toolchains, early 1990s
Open standardYes · royalty-free
Specificationlearn.microsoft.com

LIB conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with LIB files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about LIB files.

Frequently asked questions

What is a .lib file?
A library used when compiling C/C++ programs. It's either a static library (compiled object code the linker copies into your program) or an import library (stubs that connect your program to a DLL at run time).
How do I open a .lib file?
You don't open it like a document - the linker uses it during a build. To inspect one, run 'lib /list file.lib' or 'dumpbin /symbols file.lib' from a Visual Studio Developer Command Prompt (or 'ar t' / 'nm' on Linux).
What's the difference between a .lib and a .dll?
A static .lib gets baked into your program at build time (no run-time dependency). A DLL is loaded at run time; its companion import .lib just tells the linker which functions the DLL provides.
How do I fix 'cannot open file xxx.lib' (LNK1104)?
Point the linker at the right folder: add the library's directory under Linker > General > Additional Library Directories, and the file under Linker > Input > Additional Dependencies. Make sure the .lib actually exists and matches your platform (x64/x86).
Can I convert a .lib to a .dll or .exe?
No direct conversion exists - they're different build outputs. You'd recompile the source as a DLL/EXE. If it's an import .lib, the DLL already exists alongside it.
Can I extract the .obj files from a .lib?
Yes for a static library: use 'lib /extract' (MSVC) or 'ar x file.lib' (Linux), or browse it with 7-Zip since it's an ar archive.

References

1Microsoft Learn - LIB reference (Library Manager)learn.microsoft.com
2Microsoft Learn - DUMPBIN referencelearn.microsoft.com

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.MDMarkdown Document
4.BINCD/DVD Disc Image (BIN/CUE)
5.RPMSGRestricted Permission Message
6.PARTPartial Download File
7.NOMEDIAAndroid No-Media Marker File
8.EXEWindows Executable (Portable Executable)
9.AVIFAV1 Image File Format (AVIF)
10.DBSQLite Database File

Related extensions

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z