Click or drag to resize

Overview

NTagLite is a lightweight library for managing ID3 v2 and v1 tags which are normally used to embed descriptive data inside mp3 audio files. The library was authored as a C# language project in Visual Studio 2026 targeting .NET Framework 4.7.2 and .NET Standard 2.0. The full source code is freely available in the NTagLite Azure DevOps Repository.

Library Description

Because the ID3 specification is so ridiculously complicated and because only a small subset of its features and versions are in common use, the NTagLite library is deliberately designed to be "lightweight" in the sense that it supports only the most common and practically useful subset of ID3 features. This subset is still a significant part of the full specification. The library does not have full support for the following features.

  • Compression (throws NotSupportedException)

  • Grouped frames (throws NotSupportedException)

  • Encryption (throws NotSupportedException)

  • Unsynchronisation (throws NotSupportedException)

  • Extended header (the header is skipped)

  • v2.4 specific frames (they are preserved but treated like unknown frames)

  • Writing v2.2 or v2.4 tags (only v2.3 and v1.1 tags can be written)

These limitations should rarely be a problem in normal usage, as unreadable tags have only been found in the wild very rarely during library development. Adding full support for the rare features is of little practical value and would overly complicate the source code and API.

Code samples can be found in the Azure DevOps Wiki. The entry point to using the library is the LiteFile.LoadFromFile method.

C#
LiteFile file = LiteFile.LoadFromFile(@"C:\temp\Test Music\Nice Song.mp3");
:
foreach (var frame in file.Tag.Frames)
{
    Print($"Frame Id {frame.Id} offset 0x{frame.Offset:x6} Length {frame.Size:x6} {frame.Text}");
}
Author's Historical Note

Around 2004 I decided to use some hobby time to write a C# library capable of manipulating ID3 tagged audio files. I attempted to make the library generally extensible so that support for other tagging formats could be added easily, although I only concentrated on ID3 tags at first, with partial support for reading metadata out of WMA files. I used the library to drive a Windows Forms application for editing tags. The library and the application were in continuous use up until June 2014 after which they were replaced by fresh projects.

Around 2005 and in the following years the number of audio formats and tagging formats in common use grew so fast that I abandoned any attempt to support them all in my library. I even abandoned development of the library completely because I was utterly fed-up with trying to support the various types of ID3 frames. The binary formatting of the ID3 tag and frames is a short-sighted abomination in the modern computing world. Even when the "standard" was created by multiple contributors multiple contributors in 1998, XML was well established and they could have simply specified that an XML document containing tag information be embedded at the start of an audio file. If they had done that, the tag would have been self-documenting, extensible and readable, there would be no string encoding problems and there would be no need to 'synch' to remove troublesome bit patterns.

In early 2014 I decided to deprecate my own library, write a new WPF desktop application for tag editing and drive it using a free ID3 library. Out of the dozens of free libraries that are available I initially picked UltraID3Lib because it had a reasonably simple API and some sample code was available. I tried to overlook the worrying facts that UltraID3Lib was written in Visual Basic .NET and the IL was obfuscated. I was however more irritated by the fact that it returned pictures as System.DrawingBitmap objects which were not suitable for me to consume (and the author forgot to dispose them).

I then tried ID3Lib but found the API incomprehensible and there is little to no sample code. I looked at some other libraries as well but they were all amateurish, quirky or had restricted functionality.

After being frustrated by attempts to use 3rd party tagging libraries I reluctantly decided to write my own "Lite" library with a modest and practical feature set. Hence the NtagLite project was born. The project uses the interesting and often overlooked technique of generating thousands of lines of source code for classes and enumerations using a T4 Template which reads an XML file of ID3 definitions.