What is the AR file format?
The .ar archive format dates back to Unix Version 1 (1971), created at Bell Labs as the original Unix archiver. An .ar file concatenates multiple member files, each preceded by a fixed 60-byte ASCII header recording the member's name, modification time, permissions and byte size. Every archive begins with the 8-byte magic string !<arch> followed by a single line feed (0x0A).
The format stores members uncompressed by default. Two main variants exist:
- The BSD variant (used on macOS) extends long filenames inline after each member header.
- The System V/GNU variant (used on Linux) stores long names in a special
//member and prepends a/symbol index entry for efficient link-time lookup.
Today .ar is most commonly encountered as .a static libraries on Linux and macOS, where the ar tool from GNU binutils is the standard implementation. Debian .deb packages are also ar archives - renaming a .deb and extracting it reveals the inner control.tar and data.tar members. Common ar commands: ar rcs libfoo.a *.o creates an archive, ar t archive.ar lists members, and ar x archive.ar extracts them.
Security & safety
RISK: LOWAR archives themselves are containers with no executable semantics - they cannot auto-run code. However, the members inside may be compiled object files or executables that could be malicious. When extracting an ar archive from an untrusted source, inspect the extracted files before executing them. Static libraries linked into your binaries become part of those binaries; a tampered static library is a supply- chain attack vector (e.g. compromised toolchain archives). Always verify checksums when downloading toolchain tarballs containing .a/.ar libraries.
Format details
in a nutshell- Debian package (.deb) - A .deb file is an ar archive containing control.tar.* and data.tar.* members; the ar container is transparent to end users (dpkg handles it).
- .a static library (same format, different extension) - On Linux/macOS .a is the conventional extension for static libraries in ar format; .ar is less common but identical.
Programs that open AR files
Technical details
deep spec| Magic bytes | 21 3C 61 72 63 68 3E 0A - ASCII string !<arch> plus newline (0x0A) at offset 0 |
| MIME type | application/x-archive |
| Per-member header size | 60 bytes (fixed-width, ASCII-encoded fields) |
| Header field layout | Filename 16 B, modification time 12 B, UID 6 B, GID 6 B, mode 8 B, size 10 B, magic 2 B |
| Member alignment | 2-byte boundary; odd-length members padded with a single newline character (0x0A) |
| Compression | None by default - member files stored verbatim and uncompressed |
| Integrity checking | No per-member or archive-level checksums in the ar format |
| Filename limit | 16 chars in fixed header; unlimited via BSD inline extension or System V // member table |
| Format variants | BSD (macOS): inline extended names; System V/GNU (Linux): // member table for long names |
| GNU symbol index | GNU ar prepends a / symbol table member to .a archives for efficient link-time symbol lookup |
| Thin archive support | GNU thin archives use magic 21 3C 74 68 69 6E 3E 0A (!<thin>) and store file paths, not data |
| Primary uses | .a static libraries (Linux, macOS), .deb Debian packages, .ipk OpenWrt packages |
| Platforms | Linux, macOS, FreeBSD, Solaris, AIX, Windows (MinGW/Cygwin/WSL) |
| Released | 1971 (Unix v1, as the original Unix archiver) |
| Latest version | POSIX.1-2017 specifies the format; GNU ar (binutils) is current implementation |
| Open standard | Yes · royalty-free |
| Specification | pubs.opengroup.org |
Community Q&A
asked by usersNo questions yet - be the first to ask about AR files.