NEF (Nikon)

this page has been migrated to our new wiki site


The NEF format (Nikon Electronic Format) is used by several camera models manufactured by Nikon:

  • D1
  • D1H
  • D1X
  • D2H
  • D2Hs
  • D2X
  • D40
  • D40s
  • D50
  • D70
  • D70s
  • D80
  • D100
  • D200
  • Coolpix 5400
  • Coolpix 5700
  • Coolpix 8700
  • Coolpix 8800

A variant of the NEF format is the NDF (Nikon Dust reference Format) that contains a "dust reference" instead of a picture. A dust reference is a picture taken in a special way, against an homogeneous subject, in order to locate dust on the sensor. The dust reference is used by Nikon Capture Editor to automatically remove dust noise.


The header for the NEF format complies with the standard TIFF header.

TODO: NDF files are different: they have 12 extra leading bytes start with the "NDF" string.

Raster formats


There are three different types of maker note for the NEF format:

  • type 1
  • type 2
  • type 3: used by all DSLR cameras

Type 3

code name type enumeration description
1 Firmware Version undefined[4] The firmware version of the camera.
2 ISO short[2] The ISO settings used to take the photo. The first number can be 0 or 1 and could be related to the Auto ISO setting.
3 Color Mode (?) ascii COLOR The value is always COLOR. To check on D200, which has a b/w mode and probably uses a new value.
4 Quality ascii RAW, RAW2.7M The quality setting used to take the photo.
5 White Balance ascii AUTO, CLOUDY, FLASH, INCANDESCENT, PRESET, PRESET1, SUNNY, WHITE PRESET The white balance setting used to take the photo. The string is right padded with spaces.
6 Sharpening ascii AUTO, HIGH, LOW, MED.H, MED.L, NONE, NORMAL, empty The sharpening setting used to take the photo. The string is right padded with spaces.
7 Focus Mode ascii AF-A, AF-C, AF-S, MANUAL The focus mode used to take the photo. Note that the value is right padded with blanks.
8 Flash Setting ascii NORMAL, REAR, REAR SLOW, RED-EYES, LOW, empty
9 Auto Flash Mode ascii Comdr., MNEW_TTLOptional, TTL, empty
11 White Balance Fine signed short[1] Fine adjustment of white balance as set in the camera. The range is [-3..+3].
12 White Balance RB Coefficients rational[4] The first two numbers are coefficients to multiply red and blue channels according to white balance as set in the camera. The last two numbers can be 0/1, 1/1 or 256/256.
13 tag13 undefined[4]
14 Exposure Difference (?) undefined[4]
15 ISO Selection ascii AUTO, MANUAL
16 Data Dump undefined[]
17 Thumbnail Offset long[1] ????
18 Flash Compensation undefined[] ????
19 ISO Requested short[2] ????
22 NDF Image Boundary short[4]
24 Flash Bracket Compensation (?) short[1]
25 AE Bracket Compensation (?) short[1]
27 Sensor Size short[2] The horizontal and vertical photosite count on the sensor.
29 D2X Serial Number ascii The camera body serial number (only for the model D2X). This field is also used as a key for obfuscating some relevant information about white balance.
128 Image Adjustment ascii AUTO, NORMAL ????
129 Tone Compensation ascii AUTO, CS, HIGH, LOW, NORMAL The tone compensation as set in the camera.
130 Lens Adapter (?) ascii OFF ????
131 Lens Type byte[1] A bitwise mask which describes the type of lens. If not bit is set the lens is a AF non-D lens.
132 Lens Range rational[4] Two pairs focal/max f-stop that describe the lens.
133 Focus Distance rational[1] ????
134 Digital Zoom rational[1] The digital zoom used for taking this shot (it's always 1 for DSLR models).
135 Flash Type byte[1] 0, 3, 4, 7, 8, 9 The type of flash unit used.
136 AF Focus Position undefined[] Which sensor was used to lock the focus.
137 Bracketing short[1] ????
139 Lens F Stop (?) undefined[] ????
140 Curve undefined[] A lookup table (LUT) to be used for applying the contrast (see also Tone Compensation)
141 Color Mode ascii MODE1, MODE1a, MODE2, MODE3, MODE3a The color mode bas set in the camera. Note that the value is right padded with blanks
142 Lighting Type (?) ascii ????
143 Scene Mode (?) ascii ????
144 Light Type ascii COLORED, MIXED, NATURAL, NORMAL, SPEEDLIGHT ????. Note that the value is right padded with spaces; sometimes is zero-terminated.
146 Hue signed short[1] The Hue setting.
147 Flash Unknown Info (?) short[1] ????
148 Saturation signed short[1] The Saturation setting.
149 Noise Reduction ascii FP, NR, OFF
150 Compression Data undefined[] This data block contains the initial value for the predictors and a lookup table used with the Nikon compression scheme (see the Raster Format section).
151 Block 151 undefined[] The Block 151 contains some information about White Balance for D2X.
152 Lens Info undefined[] ????
153 Bayer Unit Count short[2] The number of Bayer Units (horizontal count, vertical count).
154 Sensor Pixel Size rational[2]
160 Camera Serial Number ascii An unique ID of the camera.
162 NDF Length long[1] The length of the raster data if this is a NDF image (dust reference).
167 Shutter Count long[1] A progressive number that is incremented at each shutter operation.
169 Image Optimization (?) ascii CUSTOM, NORMAL, empty ????
170 Saturation 2 (?) ascii ENHANCED, MODERATE, NORMAL ????
171 Vari Program ascii AUTO, CLOSE UP, LAND SCAPE, NIGHT PORTRAIT, NIGHT SCENE, PORTRAIT, SPORT, empty For camera models that support it, this tag contains information about the automatic program that was used.
3584 Print IM (?) undefined[] ????
3585 Capture Editor Data undefined[] When a NEF image is processed by using Nikon Capture Editor and changes are saved, this tag contains a block of bytes which contains the NCE settings.
3598 Capture Offsets (?) long[1] ????
3600 tag3600 long[1] ????
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.