NEF File Documentation


Summary

A Nikon Electronic Format (NEF) file is a Nikon camera’s RAW image: the unprocessed data straight off the sensor, like a digital negative. It is built on the TIFF/EP container, so it begins with the little-endian TIFF header 49 49 2A 00 and carries the MIME type image/x-nikon-nef. Open and develop a .nef with Nikon’s free NX Studio, or free DNG-capable editors darktable and RawTherapee; the common task is exporting to JPG.

Technical details

FeatureValue
Full nameNikon Electronic Format (Nikon camera RAW)
File extension.nef
MIME typeimage/x-nikon-nef
Format typeTIFF/EP-based proprietary camera raw image (binary)
DeveloperNikon
Introduced~1999 (Nikon D1); still used on current Nikon bodies
Open standardNo — proprietary, TIFF/EP-based
Container / base formatTIFF/EP (ISO 12234-2); structured as IFDs and tags
Byte orderLittle-endian (II); some early NEFs big-endian (MM)
Magic number49 49 2A 00 (“II*\0”, TIFF little-endian) at offset 0
Sensor dataRaw Bayer CFA samples, 12- or 14-bit, often Nikon-compressed
MetadataEXIF + Nikon MakerNote (camera, lens, exposure, Picture Control, sometimes GPS)
Embedded previewOne or more JPEG previews (full-size + thumbnail)
Compact-camera variant.nrw (Nikon Coolpix)
Official softwareNikon NX Studio (free, Windows/macOS)
Open archival targetDNG (Adobe, TIFF/EP-based, documented)
Related extensions.nrw, .dng, .cr2, .arw, .tiff, .jpg
Specification basisTIFF 6.0 + TIFF/EP; Nikon MakerNote is undocumented/proprietary
File signature (magic bytes)
49 49 2A 00

Offset 0, 4 bytes. This is the little-endian TIFF header: II (the two Is mean Intel/little-endian byte order) followed by the magic number 42 as 2A 00. NEF is built on the TIFF/EP container, so most files start this way; a few early Nikon bodies wrote big-endian TIFF, which begins 4D 4D 00 2A (“MM”). The bytes at offset 4 are a 32-bit offset to the first Image File Directory (IFD). Because the offset-0 marker is just TIFF, a NEF is told apart from an ordinary TIFF by its Nikon MakerNote tags and the “NIKON” string in the EXIF, not by a unique signature.

What is a NEF file?

NEF stands for Nikon Electronic Format, the raw image format Nikon has used in its digital cameras since the original Nikon D1 around 1999, and still produces on current DSLR and mirrorless bodies. A raw file is the data captured directly by the camera’s image sensor, before the camera turns it into a viewable picture. Think of it as a digital negative: unlike a JPEG, a NEF has not been demosaiced, white-balanced, sharpened or compressed into a finished image, so it preserves the sensor’s full tonal range and far more latitude to recover highlights and shadows or change white balance later — at the cost of large files and the need for software to “develop” it.

Technically NEF is not a bespoke format but a specialisation of the TIFF container. Specifically it follows TIFF/EP (ISO 12234-2, “Electronic still-picture imaging — Tag image file format for electronic photography”), which is the raw-photography profile of TIFF that Adobe’s open DNG is also based on. That means a NEF is a tree of TIFF directories and tags: it stores the raw sensor samples, full EXIF and Nikon MakerNote metadata, and one or more embedded JPEG previews, all addressed by the same IFD-and-tag mechanism TIFF uses. The sections below walk through that structure from the header down to the Bayer data.

The TIFF header and the IFD chain

A NEF opens with the 8-byte TIFF image-file header. The first two bytes are II (0x4949) for little-endian byte order — the order almost all NEFs use, though a few early bodies wrote big-endian MM (0x4D4D). The next two bytes are the number 42 (2A 00 little-endian), TIFF’s deliberately arbitrary magic constant. The final four bytes are a 32-bit offset pointing to the first Image File Directory (IFD):

Offset  Size  Field
0       2     Byte order: "II" (0x4949) little-endian, or "MM" big-endian
2       2     Magic number 42 (0x002A)
4       4     Offset to IFD0 (the first directory)

An IFD is TIFF’s unit of structure. It begins with a 2-byte count of how many entries it holds, then that many 12-byte entries, then a 4-byte offset to the next IFD (or zero to end the chain). Every entry is a tag, and its 12 bytes are laid out the same way regardless of what the tag means:

Bytes 0-1  Tag ID      (e.g. 0x0111 = StripOffsets, 0x8769 = EXIF IFD pointer)
Bytes 2-3  Field type  (1=BYTE, 2=ASCII, 3=SHORT, 4=LONG, 5=RATIONAL, ...)
Bytes 4-7  Count       (number of values of that type)
Bytes 8-11 Value or offset (the value inline if it fits in 4 bytes, else a pointer)

This uniform 12-byte entry is why a TIFF reader can walk a NEF it has never seen: it can read every tag’s type and length and skip the ones it does not recognise. The clever part of the design is the last field — if the value fits in four bytes it is stored inline, otherwise those four bytes are a file offset to where the value actually lives, so tags can point anywhere in the file.

How a NEF arranges its IFDs: previews, raw, EXIF and MakerNote

A NEF uses several IFDs, linked both in a chain and by pointer tags, to keep the big raw data separate from the small preview and the metadata. A typical arrangement:

IFD0                     often a small/thumbnail image + top-level tags
 ├─ SubIFD (NewSubfileType)   the full-resolution embedded JPEG preview
 ├─ SubIFD (NewSubfileType)   the RAW sensor image (CFA data)
 ├─ Exif IFD  (tag 0x8769)    exposure, ISO, aperture, lens, date/time
 │    └─ MakerNote (tag 0x927C)  Nikon-private tags (Picture Control, etc.)
 │    └─ GPS IFD  (tag 0x8825)   latitude/longitude, when geotagged
 └─ (thumbnail IFD chained via next-IFD offset)

The separation is deliberate. The full-size embedded JPEG preview is what a file browser or the camera’s rear screen shows instantly, without demosaicing the raw data — which is why thumbnails appear fast even though developing the raw is slow. The raw image itself sits in its own SubIFD, tagged so a reader can tell the sensor data apart from the preview. The EXIF IFD, reached through tag 0x8769, holds the standard camera settings; the GPS IFD (tag 0x8825) holds coordinates when the shot was geotagged. The most Nikon-specific piece is the MakerNote (EXIF tag 0x927C): a proprietary, largely undocumented sub-block where Nikon records Picture Control settings, lens data, focus information, shooting mode and more. Because the MakerNote format is private to Nikon and differs between models, raw developers reverse-engineer it, which is part of why they ship regular camera-profile updates.

The raw sensor data: Bayer CFA, bit depth and Nikon compression

The payload that makes a NEF a raw file is the sensor image in its SubIFD. It is not RGB. A typical Nikon sensor is a single monochrome grid overlaid with a Bayer colour filter array (CFA), so each photosite records the intensity of just one colour — in the common RGGB pattern, a repeating 2×2 tile of one red, two green and one blue sample. The NEF stores exactly those single-channel readings, at 12 or 14 bits per sample depending on the camera and setting, far more tonal resolution than the 8 bits per channel a JPEG keeps. Turning that mosaic into a full-colour image (interpolating the two missing colours at every pixel) is demosaicing, and it happens in the raw developer, not in the file. That is the core reason a NEF is editable in ways a JPEG is not: white balance, exposure and highlight recovery are decisions made during demosaicing from the full-precision sensor values, rather than baked into a finished 8-bit picture.

Nikon usually compresses the raw data rather than storing it flat. Options across the range include lossless compression and a “lossy” compression that applies a non-linear tone curve to the sensor values before packing them, trading a little highlight precision for much smaller files. Either way the compression is Nikon’s own, described in the MakerNote and the relevant tags, which is another reason generic TIFF readers can parse a NEF’s structure yet fail to render its picture — they can read the tags but not decode the compressed CFA data without Nikon-specific logic.

Developing a NEF and exporting to JPEG, TIFF or DNG

Because NEF is proprietary and raw, you do not edit it in place the way you would a JPEG. You open it in a raw developer, make non-destructive adjustments (the original file is never overwritten; edits are stored as instructions), and export a finished image. Nikon’s own free application, NX Studio (introduced 2021, replacing the older ViewNX-i and Capture NX-D), reads NEF with model-accurate colour and applies Nikon’s Picture Control profiles, so it reproduces the look the camera intended. Free open-source developers darktable and RawTherapee also open NEF, as do Adobe Lightroom and Camera Raw. On Windows, installing the free Raw Image Extension from the Microsoft Store is what makes NEF thumbnails and previews appear in File Explorer and the Photos app; macOS decodes Nikon raw natively in Photos and Preview.

The usual exports each serve a purpose. JPEG is the universal, compressed, ready-to-share result — keep the NEF as your master, because the JPEG discards the raw latitude. A 16-bit TIFF gives a lossless, fully-developed master for further editing in Photoshop or GIMP. DNG (Adobe’s Digital Negative, itself TIFF/EP-based) is the open archival option: it keeps the raw sensor data while shedding Nikon’s proprietary wrapper, so it stays readable by future software. One thing you cannot do is convert a NEF into another camera maker’s raw format (Canon .cr2, Sony .arw, Pentax .pef): each is tied to that vendor’s specific sensor and MakerNote, so there is no meaningful cross-vendor raw conversion. For an open raw archive, DNG is the target; to share, use JPEG.

NEF versus NRW, and why software needs camera updates

Nikon uses a closely related but distinct variant, NRW, in many of its Coolpix compact cameras, while NEF comes from the DSLR and mirrorless lines. Both are TIFF/EP-based Nikon raws and the same software (NX Studio, darktable) opens both; they differ in internal details and in which cameras write them. A more practical quirk is that every Nikon model writes a subtly different NEF — a different sensor, CFA arrangement, compression choice and MakerNote layout — which is precisely why raw software ships frequent updates: to add or correct the decoding profile for each newly released body. A developer that has never been updated for your camera may open the file (it is still TIFF underneath) but render colours wrongly, or fall back to showing only the embedded JPEG preview rather than developing the raw.

Frequently asked questions

Why can’t I see my NEF photos in Windows?

Windows does not decode Nikon raw out of the box, so File Explorer and the Photos app show no thumbnail. Install the free Raw Image Extension from the Microsoft Store and previews appear. To actually develop the files, use Nikon’s free NX Studio or a free raw editor such as darktable or RawTherapee.

What is the difference between NEF and NRW?

Both are Nikon raw formats built on TIFF/EP. NEF comes from Nikon’s DSLR and mirrorless cameras; NRW is the variant used by many Coolpix compacts. They differ in internal detail, but the same software (NX Studio, darktable, RawTherapee) opens either one.

Should I convert NEF to DNG?

It is optional. DNG is an open, documented raw format (also TIFF/EP-based) that is good for long-term archiving and broad software support, and the free Adobe DNG Converter produces it. Many photographers keep the original NEF as the master and use DNG only for archiving, since the NEF holds the exact data the camera recorded.

References