If you work with CAD drawings in enterprise environments, you know the pain: opening a heavy 2GB CAD application just to check whether a legacy .dwg file was saved in AutoCAD 2004, 2013, or 2024 format.
Most online "DWG converters" and checkers require users to upload confidential engineering drawings to a remote cloud server. In aerospace, defense, and architectural engineering, uploading proprietary IP to random third-party servers is a critical compliance violation.
Here is how we implemented a 100% private, client-side DWG binary header parser in vanilla JavaScript that resolves file versions in under 5 milliseconds.
🔍 Understanding the DWG Binary Signature
AutoCAD DWG is a proprietary binary format created by Autodesk. While parsing the full 3D B-Rep entities requires complex reverse-engineered C++ libraries (like Open Design Alliance or LibreDWG), the version specification is always located in the first 6 bytes of the binary header.
Every valid AutoCAD drawing starts with a magic 6-character ASCII string:
| Byte Offset (Hex) | ASCII Magic Code | Compatible AutoCAD Releases | Internal Format Version |
|---|---|---|---|
0x00 - 0x05 |
AC1015 |
AutoCAD 2000, 2000i, 2002 | Release 15.0 |
0x00 - 0x05 |
AC1018 |
AutoCAD 2004, 2005, 2006 | Release 18.0 |
0x00 - 0x05 |
AC1021 |
AutoCAD 2007, 2008, 2009 | Release 21.0 |
0x00 - 0x05 |
AC1024 |
AutoCAD 2010, 2011, 2012 | Release 24.0 |
0x00 - 0x05 |
AC1027 |
AutoCAD 2013, 2014, 2015, 2016, 2017 | Release 27.0 |
0x00 - 0x05 |
AC1032 |
AutoCAD 2018, 2021, 2024, 2026 | Release 32.0 |
⚡ Pure Client-Side Implementation
Instead of reading a 500MB file into memory, we use the HTML5 File.slice() API to request only the first 6 bytes:
export interface DWGVersionInfo {
headerCode: string;
autocadVersions: string;
releaseYear: string;
isModernFormat: boolean;
}
const DWG_MAP: Record<string, Omit<DWGVersionInfo, 'headerCode'>> = {
'AC1032': { autocadVersions: 'AutoCAD 2018 - 2026', releaseYear: '2018+', isModernFormat: true },
'AC1027': { autocadVersions: 'AutoCAD 2013 - 2017', releaseYear: '2013', isModernFormat: true },
'AC1024': { autocadVersions: 'AutoCAD 2010 - 2012', releaseYear: '2010', isModernFormat: false },
'AC1021': { autocadVersions: 'AutoCAD 2007 - 2009', releaseYear: '2007', isModernFormat: false },
'AC1018': { autocadVersions: 'AutoCAD 2004 - 2006', releaseYear: '2004', isModernFormat: false },
'AC1015': { autocadVersions: 'AutoCAD 2000 - 2002', releaseYear: '2000', isModernFormat: false },
};
export async function parseDWGHeader(file: File): Promise<DWGVersionInfo> {
// Read ONLY the first 6 bytes — instantaneous even for multi-gigabyte files
const slice = file.slice(0, 6);
const buffer = await slice.arrayBuffer();
const bytes = new Uint8Array(buffer);
// Convert binary ASCII codes to string
const headerCode = String.fromCharCode(...bytes);
if (!DWG_MAP[headerCode]) {
throw new Error(`Unsupported or corrupted DWG format code: ${headerCode}`);
}
return {
headerCode,
...DWG_MAP[headerCode]
};
}
🛡️ Why This Architecture Matters
- Zero Privacy Risk: Drawing files never leave the engineer's local RAM. No network requests, no cloud uploads, and 100% GDPR/ITAR compliance.
- Instant Response Time: Parsing takes less than 3 milliseconds, even on multi-gigabyte drawing sets.
- No Infrastructure Overhead: Runs entirely on the user's browser, allowing our web app to scale to millions of monthly checks at $0 server cost.
You can test the live tool directly at CADGuide DWG Version Checker or explore our open comparison of 50+ alternatives at CADGuide.tools.
Top comments (0)