.NET - 7 Decompiler Compared (2026) - NDepend Blog (original) (raw)
May 25, 2026 9 minutes read
Need to read the C# behind a compiled assembly? A good .NET decompiler turns IL code back into readable C# in seconds, and most of the best ones are free.
Short answer: for most developers ILSpy is the .NET decompiler to pick – free, open-source and cross-platform. Reach for dnSpy when you need to debug or edit an assembly, and dotPeek if you already live in the JetBrains/ReSharper world.
This article compares the leading .NET decompilers, detailing their pros and cons to help you pick the one that best fits your needs. To make comparisons easier, each decompiler includes a screenshot of the decompiled ScreenToGif App_Startup() method. The section titles also highlight key information at a glance: whether the tool is free or commercial, open-source or not, and which target languages it supports for decompilation.
dnSpy for gurus, security and hackers – [free, OSS, C# VB IL]
JustDecompile for everyone – [free, OSS, C# VB IL] (continued as CodemerxDecompile)
dnSpy for gurus, security, and hackers – [free, OSS, C# VB IL]
JustDecompile for everyone – [free, OSS, C# VB IL] (retired, continued as CodemerxDecompile)
NDepend and ILSpy collaboration: .NET decompilation on steroid
.NET decompilers compared at a glance
| Decompiler | Price | Open source | Target languages | Runs on | Debug / edit | Best for |
|---|---|---|---|---|---|---|
| ILSpy | Free | Yes | C#, IL | Windows, Mac, Linux | No (PDB gen) | Everyday decompilation |
| dotPeek | Free | No | C#, IL | Windows | No | ReSharper / Rider users |
| dnSpy (dnSpyEx) | Free | Yes | C#, VB, IL | Windows | Debug + edit | Security, low-level work |
| JustDecompile / Codemerx | Free | Yes | C#, VB, IL | Windows, Mac, Linux | No | VB.NET output, speed |
| IldAsm | Free | No | IL only | Windows | No | Raw IL inspection |
| .NET Reflector | Paid | No | C#, VB, IL | Windows | No | Legacy / history |
| NDepend | Paid | No | C#, VB, IL | Windows, Mac, Linux | No | Going beyond decompilation |
What does it mean to decompile .NET code?
When you write code in C#, VB.NET, or F#, it is compiled into IL code – short for Intermediate Language. This IL code is then stored in a DLL file, a binary format optimized for efficient storage and execution. IL is called intermediate because it sits between high-level languages like C# and the low-level native code executed by the CPU. As a result, IL is less readable than C# but still far more understandable than raw machine code.
At runtime, the Just-In-Time (JIT) compiler translates the IL code in the DLL into native code that the CPU can execute directly. JIT compilation occurs on-demand: a method’s IL code is compiled to native code only the first time the method is invoked, allowing for optimized execution while maintaining flexibility.
.NET Compilation Illustrated
Here is the .NET compilation process illustrated:
.NET Decompilation Illustrated
The .NET Decompilation process is the reverse of C# Compilation. This is why one needs a .NET decompiler tool: to obtain readable C# source code from compiled IL code.
How to decompile a .NET DLL to C#
Whichever tool you pick below, the steps are the same:
- Open the decompiler and load the assembly (File > Open, or drag the .dll / .exe in).
- Browse the assembly tree down to the namespace, class, or method you want.
- Click a member to read its decompiled C# – or switch the view to IL.
- Optionally export the whole assembly to a .csproj and reopen it in Visual Studio.
One caveat worth knowing upfront: a decompiler rebuilds equivalent C#, not your exact original file. Comments and local variable names are gone, and some compiler-generated constructs look different from what you wrote.
Now, let’s explore the .NET decompiler tools and explain their key features.
ILSpy for everyone – [free, OSS, C# IL, multi-platforms]
ILSpy is the de-facto .NET Decompiler. You can install it from the Microsoft Store.
- It’s open-sourced on GitHub.
- The project started in 2011 and is nowadays fully mature.
- It has all the features you might wish for when decompiling one or several assemblies: search a symbol, open a pre-saved list of assemblies, hyperlink navigation between symbols, and assembly metadata explorer…
- A console version, ilspycmd, can automate decompilation.
- It can generate a PDB from an assembly. A PDB file, often referred to as a symbol file, is a bridge between an assembly’s IL code and its corresponding project’s source code. PDB is primarily used by debuggers to locate positions in source code, corresponding to the currently executed IL instruction. It means that with ILSpy PDB generation, one can debug the decompiled source code as explained in this stackoverflow answer.
- It runs seamlessly on Mac and Linux thanks to ProjectRover (see also the deprecated AvaloniaILSpy). This is not the case for other decompilers listed below.
- It integrates within Visual Studio and within VSCode (although the VSCode version seems to have problems from the comments).
- Since ILSpy version 8.2, it runs on .NET 6.0 compared to .NET Framework 4.7.2 for previous versions.
ILSpy is mature
ILSpy is actually so mature that Visual Studio itself relies on it to generate source code from .NET assemblies while debugging. You can also read Decompilation of C# code made easy with Visual Studio. This is a great feature when you don’t have access to the source code of a library that your code is consuming (the black-box syndrome). However, it is not recommended to reference closed-source libraries from your code as explained in the fifth lesson of 5x Lessons Learned from Migrating a Large Legacy to .NET 5/6.
Later in the present article, we explain how NDepend and ILSpy can collaborate to achieve powerful decompilation actions like:
- Decompiling an entire assembly
- Decompiling two versions of an assembly and diff the results
- Generate dependency graph directly from the ILSpy element right-click menu
dotPeek for convenient decompilation – [free, C# IL]
dotPeek is the free .NET decompiler by JetBrains. It runs as a standalone. The tool also naturally integrates within ReSharper and thus, within Visual Studio and Rider. It has the ILSpy features listed above plus:
- ILSpy search and navigation are great. However, imagine having the ReSharper or Rider super-polished search and navigation features on decompiled code. It’s what you get with dotPeek!
- IL Viewer panel (see the screenshot below) is quite useful. For each C# decompiled statement, the IL Viewer panel highlights the corresponding IL instructions. To us, this is very useful because we include IL Offset into our production stack traces. Thus with the dotPeek IL Viewer, we can quickly assess the culprit C# line from a production crash. Notice that ILSpy has an “IL with C#” decompilation mode. In this mode, each C# statement is shown as a comment preceding its corresponding group of IL instructions, but I find it less convenient than IL Viewer.
- I like the dotPeek Process Explorer. It is quite convenient to spy any running process, list its .NET assemblies loaded, and decompile any of those assemblies in a click.
dotPeek has a downside though: on a beefy machine it takes 10 seconds to start. I guess it shares a lot of DLLs with ReSharper which notoriously slows down Visual Studio startup. On the same beefy machine, Visual Studio 2026 takes 8 seconds to open the 160 projects & 4.200 classes of the OrchardCore solution.
Why do we prefer ILSpy over dotPeek?
We used to rely on dotPeek for our regular decompilation. But the slow startup led us to use more and more ILSpy, which is quite fast, not only for the startup but for decompilation as well. It is also reactive on all commands and has a lightweight and convenient redistribution (3MB zipped to xcopy). Now we mostly use ILSpy and keep dotPeek at hand for its Process Explorer and C# + IL Viewer features when required.
dnSpy for gurus, security, and hackers – [free, OSS, C# VB IL]
dnSpy is the .NET Decompiler used by .NET gurus, security experts, and hackers who want bit-perfect control over a .NET assembly. The tool is open-sourced on GitHub and is now (March 2023) maintained under the dnSpyEx branch. Just download the latest release to try it straight.
The screenshot below shows all the assembly metadata tokens and offsets that the mere-mortal .NET developer doesn’t need. Actually, dnSpy is much more than a decompiler. It can also run and debug a compiled assembly as shown by the screenshot below. The breakpoint set with F9 is hit just 2 seconds after pressing F5 to start debugging. What’s impressive is that the PDB generation step explained above is implicit and very fast. Note that dnSpy can also attach to a running process and debug the decompiled code of its assemblies!
As if that was not enough, dnSpy is also an assembly editor. Thus dnSpy supersedes the tool Reflexil developed by our friend Sebastien Lebreton for editing IL.
Who created dnSpy?
The mysterious creator of dnSpy – wtfsck on GitHub – is the Grigori Perelman of decompilation. He/She? is also the author of the x86 (16/32/64-bit) disassembler icedland/iced and of the tool de4dot the .NET Deobfuscator. In short, for those that protect their IP with a .NET Obfuscator tool, the tool de4dot is here to “try its best to restore a packed and obfuscated assembly to almost the original assembly. Most of the obfuscation can be completely restored (eg. string encryption), but symbol renaming is impossible to restore since the original names aren’t (usually) part of the obfuscated assembly.”. This is why when it comes to securing your code, in addition to using an obfuscator we recommend also having some serious in-house protection!
JustDecompile for everyone – [free, OSS, C# VB IL] (retired, continued as CodemerxDecompile)
JustDecompile is published by Telerik. As a matter of fact, JustDecompile is to Telerik what dotPeek is to JetBrains: a free, powerful, and polished .NET Decompiler tool made by a leading tools & components corporation. These companies invested in their free decompilers to build an appealing entry point to their commercial products. The community benefits from the free tools with the maintenance level of large corporations.
JustDecompile is a polished and fast .NET Decompiler with most features mentioned in ILSpy and a plugin model. Its engine is open sourced on GitHub but hasn’t been updated since 2019 and is nowadays retired. In 2021 the project was forked to OSS CodemerxDecompile on GitHub. Here is the official website of CodemerxDecompile where you can download the Windows, Mac, and Linux versions.
If you wish to decompile to VB.NET and you find the dnSpy tool daunting with all its guru features, then JustDecompile/CodemerxDecompile is the right tool. Also, CodemerxDecompile claims to be the fastest .NET decompiler (I didn’t verify) so if you need performance it might also be the right choice.
IldAsm for nostalgia – [free IL]
IldAsm.exe is the first .NET Decompiler ever. It has been shipped by Microsoft since .NET 1.0. Actually, it doesn’t decompile but just produces textual IL code from the binary IL code in a DLL. I used it extensively when I was learning in-depth .NET back in 2002-2003. I really felt some nostalgia when producing this screenshot 🙂
.NET Reflector for history – [paid unsupported, C# VB IL]
.NET Reflector by Red-Gate is the only both commercial and unsupported .NET Decompiler in this list. With its Buy Now button on its main page, it doesn’t look unsupported, but in January 2021 I got this answer from the Red-Gate support: “.NET reflector is an unsupported tool. Support for .NET Reflector is limited to our help center and we encourage you to post on the Forum.”
Why mention .NET Reflector then, since it cannot compete by any means with the free, supported, and powerful tools already listed? Because .NET Reflector is the father of all .NET Decompilers – and even, dare I say, the father of most non-Microsoft .NET tools.
The history of .NET Reflector (worth reading)
Lutz Roeder originally developed .NET Reflector as a freeware. Its first version can be traced back to July 2002, during .NET infancy! Lutz is a seasoned Microsoft engineer and researcher. He developed the tool in his spare time. .NET Reflector was a super popular tool. Red-Gate acquired it in August 2008. Red-Gate is a leading DB tool vendor that also offers tools for .NET developers. They promised “to continue to offer the tool for free to the community” and only charge for new features. Unfortunately, they broke their promise: in February 2011 they ran into a storm of protest when charging for .NET Reflector. This led to the creation of several free alternatives, including dotPeek, JustDecompile and ILSpy. Sad story, fortunate consequences: it led to a plethora of high-quality free decompilers, which is great.
NDepend to go beyond decompilation
We started NDepend in April 2004 as a small OSS project to compute some Robert C. Martin metrics on .NET projects, to show clients when consulting. The tool was popular enough to create a commercial version in February 2007 and commit to it full-time. The tool evolved a lot. Nowadays it is more than ever supported and up-to-date with the latest .NET technologies.
NDepend is not a decompiler like the ones above. Its main source of data are assemblies and IL code, but it can also read PDB files, source files, .csproj/.sln files, and even code coverage files produced by various coverage technologies. The tool analyzes all this data to build a rich and queryable model of your .NET assets. Numerous features and use cases are based on this model:
- dependency analysis and code visualization
- quality gate, ruling, and technical-debt estimation
- reporting and CI/CD and DevOps integration
- Visual Studio extension and command line tool
- progression against a baseline
- code metrics
Explore your Code
An NDepend full-featured trial can be downloaded to assess your .NET code quality and structure, or to reverse-engineer any mysterious .NET DLL. Here the dependency diagram is obtained in 2 seconds (analysis + graph layout) from the ScreenToGif.exe assembly.
NDepend and ILSpy collaboration: .NET decompilation on steroid
Since 2022, NDepend has proposed an ILSpy plugin. This way the tools are collaborating both ways:
From NDepend to ILSpy
Just right click any assembly, namespace, class, method or field in NDepend or Visual Studio (with the NDepend extension installed). There are 3 new menus to:
- Select the code element in ILSpy
- Decompile the code element with ILSpy (Target languages: C# and IL)
- Decompile and Compare: the code element is decompiled from both the baseline assembly and the current assembly, and both text files obtained are compared. It is possible to decompile large namespaces or even entire assemblies. This is especially useful to diff two versions of an assembly. If several classes are decompiled, they are aggregated in the text file in a consistent order, which makes the code review of changes possible.
Let’s mention that to compare two sets of assemblies – older bits and newer bits – in order to use the Decompile and Compare menu, just click the Compare 2 versions of a code base link from the NDepend start page. A dialog will let you specify both assemblies sets to compare.
ILSpy is a fast decompiler. But decompiling dozens or hundreds of classes can take a few seconds or minutes. This is why a progress dialog appears with an Abort button.
From ILSpy to NDepend
It is possible to:
- Show any code element on the NDepend dependency graph or matrix
- Analyze with NDepend one or several assemblies selected
Conclusion: which .NET decompiler should you use?
We hope this post helped you decide which .NET Decompiler suits you best, and maybe change your habits. Each tool is mature and has its own enthusiast user base. Most likely you’ll end up using ILSpy or dotPeek – or dnSpy if you have a need for bit-level details. We explained why ILSpy is the .NET Decompiler tool we use regularly, and why we keep dotPeek at hand when needed. This is genuine feedback: we are not affiliated with the ILSpy team nor JetBrains, the editor of dotPeek, which is free anyway.
But, wait a minute…
Is decompiling legal?
The short answer is: Yes, unless explicitly prohibited. For example, the dotPeek License Agreement states that: “Before using dotpeek for decompilation purposes, you should make sure that decompilation of binary code is not prohibited by the applicable license agreement (except to the extent that you may be expressly permitted under applicable law) or that you have obtained permission to decompile the binary code from the copyright owner.”
The StackOverflow answer
This stackoverflow answer proposes a more liberal discourse:
“Decompiling is absolutely LEGAL, regardless of what the shills say. At most, you can be sued for unauthorized activity relating to software unless you’re redistributing it. Courts in the U.S. have always upheld the right of users to know exactly what code is being installed on their systems by programs they have legitimately obtained.
People REALLY need to quit saying “ILLEGAL” unless they know what they’re talking about. There is absolutely NO law in the U.S. that states you cannot copy for private purposes or decompile software. Companies have tried to sue to stop it, but; a) that’s only civil, not criminal, and therefore not ILLEGAL; and b) they’ve only won when the content was given to an outside party from whom the companies did not receive payment. IE the person has been shown to break the law.”
Nevertheless, a comment on the same question says: “It is, however, illegal if you decode it, take all the source code, maybe change the graphics, package, and some other things and try to pass it off as your own app. It is illegal redistribution of a copyrighted work.”
Protect your Intellectual Property
.NET Obfuscators exist since technically nothing prevents anyone from reverse-engineering your intellectual property. But understand that obfuscators and custom tricks cannot protect your IP from a determined hacker. At best, you can make the hacker’s life (much) more difficult. The only way to really protect your IP is to offer your services through a cloud or web-based approach, where your bits never leave your own server.
What is the best free .NET decompiler?
For most developers, ILSpy – it is free, open-source, fast, and runs on Windows, Mac, and Linux. dotPeek and dnSpy are also free and excellent, depending on whether you want ReSharper-grade navigation or low-level debugging.
Can a .NET decompiler recover the original source code?
Not exactly. A decompiler reconstructs equivalent C# (or VB.NET) from the IL code, but comments and local variable names are lost and some compiler-generated constructs differ from the original. Ship a PDB and you can at least debug the decompiled code line by line.
What is the difference between a decompiler and a disassembler?
A disassembler like IldAsm prints the raw IL instructions stored in the assembly. A decompiler goes one step further and rebuilds higher-level C# or VB.NET from that IL.
Does Visual Studio have a built-in .NET decompiler?
Yes. Visual Studio uses the ILSpy engine to decompile assemblies while debugging, so Go To Definition works even without source code.
Which .NET decompiler runs on Mac and Linux?
ILSpy (via ProjectRover) and CodemerxDecompile are cross-platform. dotPeek, dnSpy, and IldAsm are Windows-only.
Is it legal to decompile .NET assemblies?
Generally yes for inspection and interoperability, unless the license forbids it. Redistributing or passing off decompiled code as your own is where it becomes a copyright problem – see the legal discussion above.
This article is brought to you by the team behind NDepend — a proven .NET static analysis tool for improving code maintainability, security, and overall quality. Whether you’re modernizing a legacy .NET application or starting fresh in C#, get started with your free full-featured trial today!














