.lock

What is a .lock file?

A file saying "occupied" — prevents concurrent access or pins dependency versions.

Safe format
Type Misc
By N/A (convention)
MIME application/octet-stream

Drop any file to identify it

No upload. No signup. No sending your file halfway across the internet.
We tell you what it is, right here in your browser.

What is it

LOCK files serve two very different purposes depending on context, and both are called .lock because naming things is hard. The first use is process locking — a file created to indicate that a resource is in use, preventing other processes from accessing it simultaneously. Database engines, editors, and system services create lock files (like `/var/lock/subsys/httpd`) to coordinate access.

The second, more visible use is dependency locking in package managers. `package-lock.json` (npm), `yarn.lock` (Yarn), `Cargo.lock` (Rust), `Gemfile.lock` (Ruby), `poetry.lock` (Python), and `pnpm-lock.yaml` all pin exact dependency versions so that every developer and CI server installs identical packages. These aren't technically ".lock" files by extension (they have their own names), but the concept of a lock file has become fundamental to reproducible software builds.

The key rule for lock files: don't delete them unless you know what created them and why. Deleting a process lock while the process is running can cause data corruption. Deleting a package manager lock file means your next install might pull different dependency versions, potentially breaking your build. When a lock file is orphaned (the creating process crashed), it's safe to remove — but verify the process isn't running first.

Technical details
Full Name
Lock File
MIME Type
application/octet-stream
Developer
N/A (convention)
Magic Bytes
Varies
Safety
.lock is a known, safe format.
What opens it
Any text editor
FREE All
FAQ
Should I commit lock files to git?
For applications, yes — always commit package-lock.json, yarn.lock, Cargo.lock, etc. They ensure reproducible builds. For libraries, it depends on the ecosystem — npm recommends committing, Cargo does too, but some ecosystems differ.
A lock file is preventing me from opening a file. What do I do?
First, check if the creating application is still running. If it crashed, the lock file may be orphaned — safe to delete. On Linux, check with lsof or fuser. On Windows, tools like Process Explorer can identify the locking process.
Related formats