DXF to DWG: how to convert a DXF file to DWG
DXF to DWG needs a program that can write the DWG format, and only a handful can: AutoCAD, BricsCAD, ODA File Converter, and (partly) LibreDWG. This viewer is not one of them, it opens DXF and DWG but never saves a .dwg. Here is which tool to use, the exact steps, and the limits of each.
Why so few tools write DWG
DWG is Autodesk's proprietary binary format. Reading it has been reverse-engineered well (the Open Design Alliance and LibreDWG both do it), but writing a DWG that every AutoCAD release opens without errors is harder, so free programs tend to stop at DXF. LibreCAD, QCAD Community, and Inkscape read DXF and write DXF; they do not write DWG at all. Knowing this saves you from searching for a setting that does not exist.
Do you actually need the DWG? Every CAD program, including AutoCAD, opens DXF directly, and the two formats store the same objects (see DXF vs DWG). The usual real reasons are a client who insists on .dwg, a file-size limit, or a system that filters on extension.
Which method for which case
| Case | Tool | Writes DWG versions |
|---|---|---|
| You have AutoCAD, AutoCAD LT, or BricsCAD | Open DXF, SAVEAS DWG | R14 to current |
| No CAD; Windows, macOS, or Linux; batch | ODA File Converter (free) | R12 to 2018 |
| Scripting on Linux or a server | LibreDWG dxf2dwg | R2000 reliably; others experimental |
| You use QCAD | QCAD Professional (not Community) | R12 to current via Teigha |
| You use LibreCAD | Not possible; save DXF and use ODA | none |
| Non-confidential one-off | Online converter (CloudConvert and similar) | Varies; file is uploaded |
How to convert DXF to DWG with ODA File Converter (free)
- Download ODA File Converter from the Open Design Alliance site for your OS and install it.
- Put the DXF files in one folder. The converter works on folders, not single files, so a folder with one file is fine.
- Set the input folder and an output folder. Tick "Recurse folders" if you have subfolders.
- Choose the output version (for example ACAD2018) and the output type DWG. Tick "Audit" to let it repair minor DXF errors on the way.
- Click Start. A log lists any file it could not convert, usually a truncated or hand-edited DXF.
- Open the result on dwgviewer.app to confirm it loads and the layers are there.
For scripts: ODAFileConverter in_dir out_dir ACAD2018 DWG 0 1 runs without the window. This is also the engine FreeCAD and several other programs call when they offer "export DWG".
AutoCAD, BricsCAD, and LibreDWG
In AutoCAD the conversion is a save: OPEN the DXF (set file type to DXF in the dialog), then SAVEAS and choose a DWG version. AutoCAD LT does the same. If the DXF was written by Inkscape or a CNC program, run AUDIT with fix set to Yes before saving, because such files often contain entities with missing handles. BricsCAD behaves identically and also runs on macOS and Linux.
LibreDWG ships dxf2dwg: dxf2dwg -o plan.dwg plan.dxf. Its DWG writer targets R2000 reliably; writing newer versions is marked experimental by the project, so use it for pipelines where R2000 DWG is acceptable and validate the output. For an R2018 DWG from a script, ODA File Converter remains the safer choice.
DWG TrueView is built around DWG version conversion; for DXF input, ODA File Converter is the more reliable free route. Also see the reverse direction, DWG to DXF, which has more free options.
What to check in the DWG
- It opens at all. A DXF with syntax errors converts to a DWG that AutoCAD reports as corrupt. If that happens, run RECOVER on the DXF first, or tick Audit in ODA.
- Version. A DWG saved as 2018 will not open in AutoCAD 2013. Match the oldest release your recipient uses; the version table helps.
- Layers and blocks. Inkscape-generated DXF has one layer and no blocks; that is not a conversion loss, the DXF never had them.
- Units. DXF written by non-CAD tools often has no unit flag. Set
INSUNITSafter import so the DWG scales correctly when inserted elsewhere.
The layers panel and entity count on dwgviewer.app show the first three at a glance, with the file never leaving your computer. If the DWG refuses to open, fixing a DWG that will not open lists the common causes.
Frequently asked questions
How do I convert DXF to DWG?
Open the DXF in AutoCAD or BricsCAD and Save As DWG, or run the free ODA File Converter with DWG as the output type.
Can you convert DXF to DWG for free?
Yes. ODA File Converter is free for Windows, macOS, and Linux and converts single files or whole folders. LibreDWG's dxf2dwg is free and open source but writes R2000 DWG.
How do I convert DXF to DWG in AutoCAD?
Use OPEN with the file type set to DXF, run AUDIT if the file came from a non-CAD tool, then SAVEAS and pick the DWG version you need.
Can LibreCAD convert DXF to DWG?
No. LibreCAD reads DWG but saves only DXF. Save the DXF from LibreCAD and convert it with ODA File Converter.
How do I batch convert DXF to DWG?
ODA File Converter processes a folder in one run, with recursion into subfolders. From a script, call ODAFileConverter with the input and output folders, version, and DWG.
Does this viewer convert DXF to DWG?
No. dwgviewer.app opens DXF and DWG in the browser and exports PDF, SVG, and PNG, but it never writes a DWG file.