2D Barcode for Mobile – What Size?

What barcode size for mobile devices?So you need to produce a 2D barcode for use with mobile devices? What size should it be to ensure that every smartphone can successfully read it?

I had to do some testing on this for one of our clients and I thought it would be interesting to share the results here as well.

To start, if you are planning to use a 2D barcode in a project, chances are that it will be either Datamatrix or QR Code that you are turning to.

Being an industrial barcoding guy, I would normally turn to Datamatrix, but the QR Code has become very popular for all kinds of mobile applications and probably has a bigger infrastructure of scanning apps that can read it. I think every scanning app I’ve come across supports QR, but not every one can read Datamatrix.

It really doesn’t matter which you choose, in either case it is important that the barcode is small enough to be able to fit inside the space allocated for it, but large enough to be successfully scanned every time – we’ve all been frustrated by 2D barcodes that won’t scan (or scan but don’t do what they are supposed to do – that’s a different story!) and we don’t want to annoy our potential clients.

2D Barcodes - which one to use?One important thing is to understand how we define the size of a barcode. Generally we wouldn’t measure the size of a Datamatrix or QR Code and say “this QR Code is 1 inch square”. Well actually we could do that, but it doesn’t really help here.

What we are interested in is the Element Size – the size of the little individual squares that make up the barcodes.

Here’s a screenshot from the label design software I use, BarTender:

Setting the Element Size in a 2D barcode.

The size of the barcode elements is determined by the “X Dimension”. This is actually a reference to linear barcodes, such as UPC codes, where the X Dimension is the width of the small bar in the barcode. For 2D barcodes, such as Datamatrix and QR Codes, this dimension is the width of the small elements that make up the code. The units of this in BarTender are “mils” where one mil = 0.001 inches.

When printing barcodes for industrial barcode scanners (both linear and 2D) it is a good practice to keep the X Dimension greater than 7.5 mils (0.0075 inches). This ensures that any industrial quality barcode scanner is able to read the barcode. Note that label printers are not able to print any size barcode – this is discussed in my printer resolution article here.

But what about barcodes intended to be read with consumer phones, such as iPhones or Android devices? One thing is for sure, smartphone cameras are getting to be really good these days, but they are not high resolution barcode scanners.


To check this out (in an admittedly non-scientific test) I printed out some Datamatrix and QR Codes in various sizes and tried to read them using the QuickMark app in my iPhone.

2D Barcode Scan Test

2D Barcode Scan Test

The table on the right shows the results I got.

Obviously barcodes with a 33 or 20 mils size are simple to scan – the scanner app captures the image and decodes the barcode just as fast as I can point the phone camera at them.

Go down to 16 mils and things change a little. I found that the QR Code scanned quite well, but the Datamatrix was a little tricky and needed some focusing in and out to grab the image.

At 10 mils, I could not decode a Datamatrix at all, but the QR was readable – not as fast to capture as the larger sizes, but still usable. I suspect this better performance from the QR code might be because the reader is optimized for this symbology.


I did mention that my little test wasn’t scientific and I’m sure that scanning performance varies a lot between different smartphones and different scanning apps. Someone carrying out the same test with different hardware/software might well get different results.

With this in mind, I wouldn’t go below 20 mils for any 2D barcode that needed to be read by a consumer device.

Of course, making the Element Size larger increases the overall size of the barcode and it might get to be too big for the space allowed. If this happens look at making the amount of encoded data smaller. If it is a URL, use a shortener service to reduce the number of characters (we use a custom bit.ly URL, winco.cc for our shortened links) and if contact information use a vCard service such as Microsoft Tag (we use this on our business cards and it is great).

It is always a trade off between size and amount of data, but if you think it through, you can come up with a scenario that encodes all the data you need at a size that is readable for anyone with a smartphone.

Do you use 2D barcodes on your products or marketing? How do you make sure that your codes are always readable? What’s your favorite smartphone barcode app? Can we help you with your labeling or barcoding? Call me at 603-598-1553 x237 if we can!

Share Button


  1. I’m trying to understand something here. “mil” as you’ve referenced above is: “The units of this in […] ‘mils’ where one mil = 0.001 inches.”

    However, just under this statement, you write, “7.5 mils (0.075 inches)”. With the first conversion, wouldn’t 7.5 mils = 0.0075 inches?

    And just to be perfectly clear, a “mil” is NOT equivalent to a millimeter (mm), correct? Thanks so much.

  2. David Holliday says:

    Thanks for pointing that out, Daryl. It should of course be 0.0075 – I’ve made the correction.

    Yes, calling thousandths of an inch “mils” shouldn’t be confused with millimeters (I grew up in the UK where we always referred to mm’s as “mils”.

    Even after living in the US for more than 20 years, I still much prefer the metric system.

  3. Just want to point out a few things. It is a common notion that there should be a guideline for printing 2D Barcodes so it is universally scannable. This is ok but you have to be aware that setting the guideline based on the print size is a moving target, and this is because the readability of a barcode has more to do with the captured image size and the camera device used to capture it than the printed size of the barcode.

    I believe for now the most common denominator is a capture size of 640x 480 but it is rapidly moving towards Full HD 1080P for the newer phones and 2160P (4K video) a few years from now. (barcode auto capture typically use video feeds rather than snap shots)

    Read on if you want more technical details.

    Barcode detection software works by scanning a captured image for barcode bits or modules – this is an area in the barcode that is either black or white. At least for the SDK (ZBar) that I have been working on (although I suspect that this is true for most camera based (as opposed to laser based) barcode software kits), they will require a minimum width of 3 pixels per module (for 2 D barcodes i deduct that this is a square area of 3×3 pixels).

    datamatrix barcodes vary in size from 10×10 modules to 144×144 modules (those that contain 2,300+ characters). the minimum image size therefore varies from 30×30 pixels to 432 x432. The size depends on 2 factors the content to be imbedded and error correction level see http://en.wikipedia.org/wiki/Data_Matrix

    The 30×30 to 432×432 refers to the minimum size of the barcode part of the captured image.

    The captured image size itself varies based on the App setting used. For iPhones IOS 6 use to have a few video settings normal is VGA (640×480) and high (1080P – if the device supports it) but this has increased many times in IOS7. The preset capture size is now 720P for an iPhone 5. You will need to confer this with your app developer if setting the video capture size are not available within the app.

    Given this information supposing you need to scan a data matrix barcode with 144×144 modules (432×432 pixels) with an iPhone app set to capture it in VGA, the data matrix barcode needs to fill the entire screen width to get a capture image width of 480 pixels, given the imperfection of the image/ light conditions, (or if your app is cropping the image – in a bid to save on resources) etc. it will probably not be able to process the image (but if the capture was set to FullHD – it will easily process it with 50-70% of the screen filled with the barcode). Of course if your image is 50×50 (150×150), the barcode needs to fill 30% or more of the width of your screen to scan successfully.

  4. David Holliday says:

    Good stuff, thanks for posting!

  5. You are welcome!

  6. Hello David,

    I have stumbled upon this article because I wanted to get more info regarding the “best” size for 2D barcodes (I am currently working on a BSc Thesis on pattern recognition and I am researching alternatives to QR codes).

    I wanted to add some information that I think this post is missing.

    The size of the barcode, whatever it is, it heavily depends on:

    – Capture device resolution
    – Capture device Minimum Focus Distance / Alternatively, required scanning distance
    – Lighting conditions
    – Colours (Yes or No)
    – Printer resolution and surface used (printer can have very high dpi but it needs also a low-grain surface)

    The article shows the sizes and whether a code has been successfully decoded or not, but that heavily depends on one (or more) of the parameters I have stated above.

    I am not sure if you have been keeping the same exact distance, focus, lighting (a controlled environment) with same light temperature; but I guess that is not the case.

    Because saying that a ’33 mils’ QR code can be read can be both true and false: what if I am scanning it from 5 meters of distance? What if I am putting the phone/camera right on the piece of paper? You get very different issues.

    I am currently scanning QR codes that have a side less than 0.20 inches (0.5 cm) long from a distance less than 2 cm (using a macro lens), an HD camera (also tested with IR camera) and with controlled lighting conditions (in the case of IR, no need); the limitations now are printer and surface related.

    What I am trying to state is that this articles had a very good goal but missed the point along the way, making any result unusable by anyone else other than you (and I mean you personally).

    If you have more questions, let me know 😉


  7. David Holliday says:

    Alberto, I think you are reading more into this than I intended.

    You are quite correct about all the different parameters that can go into determining whether a particular barcode (of any type can be scanned). Heck I’m sitting here surrounded by printing equipment, industrial barcode scanners and verification tools right now.

    For the general mobile applications I had in mind though, all of this is not too relevant because the aim is to create a barcode than can be easily read by an app on a phone.

    If, as a marketing guy, I want to include a QR Code in a printed ad, it is of very little use if I print a barcode that needs a macro lens to be used to be able to scan it. 99.99% of my potential people will be using a simple app such as that I used in the test.

    In the industrial barcode world, things are much simpler. The US Department of Defense uses Datamatrix barcodes extensively and they specify that the element size must be between 0.0075 and 0.025 inches, with a maximum overall size of 1 inch square. This ensures that the barcodes can be read with just about any 2D industrial barcode scanner.

    The topic for your thesis sounds really interesting. You’ll have to keep me up to date with what alternatives for QR Codes you come up with!

  8. Ashish Gupta says:

    I having 2d barcode on my PCB & dimension is 5*5 mm. In this case what will be Resolution for the 2d barcode

  9. David Holliday says:

    Ashish, generally for small barcodes, I’d want to go with a 400 or (better) 600 DPI printer.

  10. jeff Phillips says:

    Quote: It is a good practice to keep the X Dimension greater than 7.5 mils (0.0075 inches). For DataMatrix, your empirical study suggests 20 mils or greater. I understand this number is dependent on the printer (we have purchased a laser etcher) and the resolution of the scanner.

    Wouldn’t you say then that it is a good practice to keep the X Dimension greater than 20 mils (0.020″) inches????

    Perhaps your 7.7mil min relates to QR Codes???

  11. David Holliday says:

    Hi Jeff, thanks for your comment.

    We have found from experience that 7.5 mils is a good minimum element size when using industrial barcode scanners. This is also the minimum size when printing barcodes for complying with standards such as the Department of Defence MIL-STD-130. Sure you can get scanners that will read much smaller barcodes, but at 7.5 you can be sure that just about any decent scanner will work.

    For barcodes that need to be scanned by smartphones, the 20 mil size seems to work well. When companies are selling consumer products, they have no idea what phones and what apps their customers might be using.

    With the barcodes you are printing with your laser, are they intended to be used for traceability on the products (when they would most likely be scanned with industrial scanners) or marketing barcodes on your packaging for your customers?

Speak Your Mind