Converting mils to Metric for PCB Design

Conversion tables and a python script to make life a little easier in converting board designs from mils to metric (mm)

Overview

We decided to give up on inches / mils for circuit board (PCB) design because it's a hindrance to keep going back and forth between mils and mm. Prior to the switch, we were calculating our design rules, trace widths & gaps, board outline and drill holes in mils and everything else in mm. Hopefully, we're leaving some headaches behind, and we'll use the tables and python script below to help us with the conversion. We'll update this page throughout 2018 to document any issues we encounter in giving up the inch.

Base Conversions:

  • 1 inch = 2.540 cm = 25.40 mm
  • 1 cm = 10 mm
  • 1 mil = 0.001" (one thousandth of an inch)

Chip Scale Discretes

No more 0402's and 0603's, it's now 1005 and 1608. Keep in mind that an 0402 is approximately 40 mils X 20 mils ( 0.04" x 0.02")

inch metric L (mm)* W (mm)*
0402 1005 1.0 0.5
0603 1608 1.55 0.855
0805 2012 2.0 1.25
1206 3216 3.2 1.6
1210 3225 3.2 2.5
* nominal

Some common mils to mm conversions

mils mm mm rounded
3 0.076 0.075
4 0.102 0.10
5 0.127 0.125
6 0.152 0.15
8 0.203 0.2
12 0.305 0.3

conv.py

Provided below is a simple but handy python3 script for converting back & forth between mils and mm.

##############################################################################
#
# Copyright (c) 2017 Mind Chasers Inc.
# All Rights Reserved.
#
#    file: conv.py
#
#    convert between mm and mil
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################

import os, sys

INCH_TO_MM = 25.40

def conv_to_mm(mils):
    """ convert mils to mm """
    return 0.001*INCH_TO_MM*mils

def conv_to_mils(mm):
    """ convert mm to mils """
    return (1000/INCH_TO_MM)*mm

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print ('usage: ' + os.path.basename(sys.argv[0]) + '  ')
        sys.exit()

    value = float(sys.argv[1])
    unit = sys.argv[2]
    
    if unit.startswith('mil'):
        print("%.3f" % conv_to_mm(value)  + ' mm')
    elif unit.startswith('mm'):
        print("%.3f" % conv_to_mils(value) + ' mils')
    else:
        print('unit not supported')

References

Please help us improve this article by adding your comment or question:

email addresses are neither displayed nor shared