The problem of Electronic Data Interchange over networks is well known and understood. Today, the most common formats for data interchange are things like XML and JSON. There are various pros and cons of using one format over the other, and certain formats lend themselves better to certain data-sets.

I've been programming for quite some time now, and I've only just NOW come across the ASN.1 (Abstact Syntax Notation) format, which is apparently used in certain Internet protocols such as LDAP, and is actually quite old (in Internet years). I read a bit about the format. Like JSON, it provides primitive data types (boolean, integer, etc.) and also sequence and set types.

It's a bit different from JSON or XML in the sense that, while the notation itself is human readable, the encoding is usually not human readable (it is usually encoded in a binary format.)

Is there some reason why this format is so rarely used? (Or am I totally wrong, and it is actually used often?) I've only just now heard of it for the first time, and I've never heard it come up in any of the various discussions I've read about the merits of JSON, YAML, XML or whatever interchange format. Is there some major drawback to ASN.1 that prevented it from being more widely used?

  • "it is not human readable, and it must be encoded in a binary format" - the wiki article you link to has an example of XER encoding (XML).
    – Mat
    Jul 22, 2013 at 15:21
  • @Mat, that's true. usually it's encoded in BER, which is binary
    – Channel72
    Jul 22, 2013 at 15:22
  • I was just reacting to your statement that it must be encoded in a binary format.
    – Mat
    Jul 22, 2013 at 15:25
  • Almost all modern commercially available cryptography uses objects in ASN.1 encodings. Jul 22, 2013 at 15:38

3 Answers 3


ASN.1 is actually very widely used. Every cell phone made today uses ASN.1 Unaligned Packed Encoding Rules as part of its low level protocol. ASN.1 is used in Aviation protocols for communications between ground and airplanes. ASN.1 is used in communications with Satellites (as in GPS systems). ASN.1 is used in communications between banks and in credit card transactions. Every time you connect to a secure website using https, you are using ASN.1. ASN.1 is used for electronic toll systems so that you don't have to stop at toll booths to pay your toll on freeways or highways. ASN.1 is used by some shipping companies to keep track of their packages. These some of the areas where ASN.1 is used.

It is unfortunate that it has not gotten publicity as a robust way of disparate machines with disparate operating systems and even disparate programming languages all being able to communicate with each other.

It even supports communication with XML Schema engines via the XML Encoding Rules. The latest generation of cell phones using LTE (Long Term Evolution) heavily relies on ASN.1, so it is not going away any time soon. It is a mature technology with a proven track record, and continues to be widely used.


There are probably to main reasons why ASN.1 appears to be used so little compared to XML/JSON.

  1. Contrary to XML (and JSON), ASN.1 is not a data interchange format, but primarily a language to define what the exchanged data means (plus a whole set of ways to encode that data). As a data definition language, ASN.1 is much more comparable to XML Schema Definitions or DTD's (Document Type Definitions). As there are a multitude of ways (both formal and informal) to define the meaning of a data interchange message, but fewer actual data interchange formats in common use, you are more likely to encounter a specific format than you are to encounter one of the formal definition methods.

  2. As noted, ASN.1 is usually used in combination with binary interchange formats. This means that if you work in an environment that deals primarily with human-readable formats (like many of the internet protocols), you are unlikely to encounter ASN.1 definitions for the data interchange. On the other hand, if you work in an environment that traditionally uses pure binary protocols, you might be much more familiar with ASN.1 notations.

In summary, The apparent popularity of XML/JSON over ASN.1 is partly due to comparing apples to oranges (interchange format versus definition language) and can be in part explained by cultural (programming) background.

  • 1
    why is asn.1 not a data interchange format? if i have a x509 certificate which is encoded in asn.1 is this not a kind of data interchange?
    – k3b
    Jul 22, 2013 at 16:11
  • 1
    @k3b: As the ASN.1 standards provide for at least 6 different ways of encoding an ASN.1 specification, the statement that your x509 certificate is ASN.1 encoded is completely uninformative. The ASN.1 BER encoding is a data interchange format, but ASN.1 itself is not. At best is is a combination of specification language and a collection of interchange formats, but the specification language part of it should not be underestimated. Jul 22, 2013 at 16:43
  • Then am I correct in assuming that the actual specification language is only useful in documentation? Is the actual specification language ever processed by a computer? (Apart from ASN.1 compilers which convert ASN.1 to some encoding format)?
    – Channel72
    Jul 22, 2013 at 17:01
  • 1
    @Channel72 - What would you use it for? It's pretty much focused on defining data structures, and that's something you generally only do in documentation or at compile time. Now something like ASN.1 BER you'd use to encode an actual message, and that is used in a lot of other specifications. Jul 22, 2013 at 17:41
  • Network hardware documents its SNMP interface as an ASN.1 spec. Software can parse this directly to figure out how to communicate with various devices, rather than having to write a driver for each type. Having the schema allows you to query, display and reflect over the data without hard-coding anything.
    – Useless
    Oct 23, 2014 at 15:21

Binary asn.1 content is optimized for minimal data and implementation footprint. This was important in the days when embedded systems had only 2k of ram.

Today it is more important to have a human readable intuitive format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.