Why 6-Bit Code my lenses?

Every digital Leica M since the M8 reads six small marks on the lens mount. Those marks tell the camera which lens is fitted. Code an uncoded lens and the camera starts recognising it, applying the right optical corrections and writing the lens name and numbers into every file.

This page covers what the code does, how to read it, and how to apply one yourself. For the codes themselves, use the Leica 6-Bit Lens Code Finder.

What the camera does with the code

  • Lens data in EXIF. Lens name and focal length are written into every file, so you can filter by lens in Lightroom instead of guessing months later.
  • Automatic lens corrections. The camera applies the correction profile for that lens, handling vignetting, chromatic aberration and distortion. Cleaner JPEGs and less work on RAWs.
  • Correct image stabilisation on the SL2 and SL3. With an M adapter, the body needs to know the focal length to stabilise properly. An uncoded lens leaves it guessing.

That last one is the reason most SL2 and SL3 owners end up coding their lenses. It is not a nicety. Stabilisation calculated for the wrong focal length works against you.

Which cameras read it

Every digital M from the M8 onwards, including the M8, M9, M-E, M Monochrom, M240, M262, M10 family, M11 family and the Pixii. Also the SL2 and SL3 when you are using M glass on an adapter.

Film bodies ignore the code entirely, so there is nothing to gain from coding a lens you only use on an M6 or an MP. No harm either, if you share lenses between film and digital.

How the code works

Six positions sit in a shallow arc on the lens bayonet flange. Read them clockwise from twelve o'clock, positions one through six. Black is a one, white is a zero. Codes can start with either, so 010000 on the Tri-Elmar 16-18-21mm is as valid as 100000.

A few lenses share the same code. For example: The Summilux-M 35mm f/1.4 Steel rim and the Thambar-M 90mm f/2.2 both read 001100. The camera still tells them apart, because the code is not the only thing it reads. The position of the frame selector lever, which every M lens physically sets according to its focal length, is combined with the six bits to identify the lens.

Coding a lens yourself

The marks are nothing more than black ink and white paint. There is no chip, no contact and nothing electronic. A black mark absorbs the light from the camera's reader, a white one reflects it. Which means you can apply a code with a pen, change it whenever you like, and remove it completely with a cotton bud and a little lens cleaner.

The practical difficulty is not the marking, it is the placement. The pits are small, close together, and sit on a curved surface you cannot easily see while you work. Free-handing it usually ends in a smudge across two positions. That is the problem our M-Coder Kit solves: it clips onto the flange and holds the pen over the right pit, so a code takes around twenty seconds instead of a careful ten minutes.

What you mark with matters as well as where. The camera's reader is more sensitive than you would expect, and most black inks either fail outright or read intermittently, so an ordinary marker is not a substitute for the pens supplied with the kit.

If your lens has a screw sitting where a mark should go, fill the recess with the white paint pen first, then either leave it or mark over it in black depending on what the code needs.

If your lens is not listed

Third-party lenses code to the closest Leica equivalent. Match the focal length first and the maximum aperture second, since the correction profile is built mostly around the optical design at that focal length.

When you are unsure between two candidates, put the camera on a tripod and shoot the same scene with each code. Look at the corners at the widest aperture, where vignetting and colour shift are most visible. The right code is usually obvious side by side. Working through a few lenses this way takes about twenty minutes.

Find your lens code

Every Leica 6-bit code in one searchable place, alongside the closest matching profile for third-party M-mount glass from Voigtländer, Zeiss, Light Lens Lab, Thypoch, TTArtisan, 7Artisans, Konica, Mandler and more.

Open the lens code finder

Code your own lenses

The M-Coder Kit holds the pen in the right place so you can code, re-code and clean off any M-mount lens in about twenty seconds. Designed and made in the UK.

See the M-Coder Kit