The basics
What is a DICOM file?
DICOM, Digital Imaging and Communications in Medicine, is the international standard for medical images. It defines both a file format and network protocols, which is why scanners, workstations and hospital archives (PACS) from different manufacturers can exchange images. A .dcm file is one DICOM object: usually one image, such as one slice of a CT scan, one X-ray or one ultrasound frame, but it can also be a multi-frame image, a video, a report or a radiotherapy plan.
The standard began in 1983, when the American College of Radiology and the National Electrical Manufacturers Association (NEMA) formed a committee. Their first standard, ACR-NEMA 300, appeared in 1985 and connected devices point to point over a dedicated 16-bit parallel interface; a second version followed in 1988. The third version, in 1993, moved to TCP/IP networks and was renamed DICOM. NEMA remains the secretariat, and the standard, published as PS3, is revised several times a year.
A DICOM file is always both picture and record. Next to the pixels it carries who the patient is, when and where the scan was made, with which machine and settings, and how the pixels should be shown. That makes DICOM files useful, and sensitive.
- A scan is many files. A CT or MRI study is usually hundreds of
.dcmfiles, one per slice, grouped into series. Viewers put them back together. - Files from a hospital disc often have names like
IM000001and no extension. Part 10 of the standard limits each part of a file name on such media to 8 characters; theDICOMDIRfile at the top of the disc is the index. - Not a picture format. Pixels are often 12 or 16 bits with a meaning (in CT, Hounsfield units), and a viewer must apply window settings to turn them into a grey image on screen.
Anatomy
What's inside a DICOM file
A DICOM file is a 128-byte preamble, the four letters DICM, a short File Meta Information group and then the data set: a list of data elements, each with a tag, a value representation (VR), a length and a value. Below are the bytes of a tiny 4 × 4 greyscale image written with pydicom for this page, with an invented patient, "Example^Ada". It isn't a download. Numbers are little-endian, so the tag 10 00 10 00 is (0010,0010).
offset 0 00 00 00 … (128 bytes) preamble, unused
offset 128 44 49 43 4D "DICM"
File Meta Information (always Explicit VR Little Endian)
02 00 00 00 UL 04 00 A0 00 00 00 (0002,0000) group length 160
02 00 01 00 OB 00 00 02 00 00 00 00 01
(0002,0001) meta version 1
02 00 02 00 UI 1A 00 "1.2.840.10008.5.1.4.1.1.7"
(0002,0002) Secondary Capture
02 00 10 00 UI 14 00 "1.2.840.10008.1.2.1"
(0002,0010) transfer syntax:
Explicit VR Little Endian
02 00 12 00 … 02 00 13 00 … implementation: PYDICOM 3.0.2
Data set
08 00 16 00 … 08 00 18 00 … SOP Class and Instance UIDs
08 00 60 00 CS 02 00 "OT" (0008,0060) Modality: other
10 00 10 00 PN 0C 00 "Example^Ada " (0010,0010) Patient's Name
10 00 20 00 LO 0A 00 "TEST-0001 " (0010,0020) Patient ID
28 00 02 00 … (0028,0002) 1 sample per pixel
28 00 04 00 CS 0C 00 "MONOCHROME2 " (0028,0004) greyscale
28 00 10 00 US 02 00 04 00 (0028,0010) Rows: 4
28 00 11 00 US 02 00 04 00 (0028,0011) Columns: 4
28 00 00 01 US 02 00 08 00 (0028,0100) Bits Allocated: 8
28 00 01 01 … 28 00 03 01 … bits stored, high bit, unsigned
E0 7F 10 00 OB 00 00 10 00 00 00 (7FE0,0010) Pixel Data,
00 10 20 30 40 50 60 70 80 90 A0 B0 … 16 bytes
end of file: 530 bytes- 1
00 00 00 … (128 bytes)The preamble
128 bytes with no fixed meaning, reserved for applications. Unused, they must all be zero. Because anything may go here, a file can be both a valid DICOM image and something else (see the security section).
- 2
44 49 43 4DThe DICM prefix
The ASCII letters
DICMat offset 128: the format's signature, defined in part 10 of the standard and registered with IANA. A file without them can still be DICOM data (some old systems wrote raw data sets), but it isn't a standard DICOM file. - 3
02 00 00 00 UL 04 00 A0 00 00 00A data element
Tag (0002,0000): group 2, element 0, each a 16-bit number.
ULis the VR, unsigned long.04 00is the length, 4 bytes.A0 00 00 00is the value: 160, the number of bytes in the rest of group 2. Every element in the file has this shape. - 4
OB 00 00 02 00 00 00Long-form lengths
For some VRs, including
OB,OW,SQ,UNandUT, two reserved zero bytes follow the VR and the length takes 4 bytes. Lengths can also be "undefined" (FF FF FF FF) for sequences and compressed pixel data, which then end with delimiter items. - 5
"1.2.840.10008.1.2.1"The transfer syntax
Element (0002,0010) says how the data set after group 2 is encoded: here Explicit VR Little Endian, uncompressed. A JPEG 2000 or JPEG-LS transfer syntax would mean the pixel data is compressed. The meta group itself is always Explicit VR Little Endian.
- 6
"1.2.840.10008.5.1.4.1.1.7"The SOP class
What kind of object this is. 1.2.840.10008.5.1.4.1.1.7 is Secondary Capture, an image converted from another source. A CT slice, an MR image or a structured report would each have their own UID.
- 7
10 00 10 00 PN 0C 00 "Example^Ada "Patient data
Patient's Name, with
^between family and given name, padded with a space to an even length. In a real file this is a real person, next to their ID, birth date and sex. That's why DICOM files are personal health data. - 8
28 00 10 00 US 02 00 04 00Image description
Group 0028 describes the pixels: rows, columns, samples per pixel, photometric interpretation (
MONOCHROME2: 0 is black), bits allocated and stored. A viewer needs all of them to decode the image. - 9
E0 7F 10 00 OB 00 00 10 00 00 00Pixel Data
Tag (7FE0,0010), usually the last element. Here 16 bytes, one per pixel, a ramp from 0 to 240. In a CT slice it's typically 512 × 512 pixels of 16 bits, or a compressed stream.
Under the hood
Tags, VRs and data elements
Everything in a DICOM data set, from the patient's name to the pixels, is a data element:
| Part | Size | What it is |
|---|---|---|
| Tag | 4 bytes | Group and element number, written (gggg,eeee): (0010,0010) is Patient's Name, (7FE0,0010) Pixel Data. Elements appear in tag order. |
| VR | 2 bytes (explicit VR only) | Value representation, the data type: PN person name, DA date, UI unique identifier, US unsigned short, SQ sequence, OB/OW bytes and words… |
| Length | 2 or 4 bytes | Number of value bytes, always even. Some VRs use 4 bytes after 2 reserved bytes; FFFFFFFF means undefined length. |
| Value | Length bytes | Text padded with a space, numbers, or for SQ a nested list of items, each a data set of its own |
In implicit VR encoding the VR is left out and the reader looks it up in the data dictionary by tag. Elements with an odd group number are private: manufacturers use them for their own data, and their meaning is documented, if at all, in the vendor's conformance statement.
| UID | Name | Pixel data |
|---|---|---|
1.2.840.10008.1.2 | Implicit VR Little Endian | Uncompressed; DICOM's default transfer syntax |
1.2.840.10008.1.2.1 | Explicit VR Little Endian | Uncompressed, with the VR written in each element |
1.2.840.10008.1.2.4.50 | JPEG Baseline | Lossy JPEG, 8-bit |
1.2.840.10008.1.2.4.70 | JPEG Lossless | Lossless JPEG, a mode rarely seen outside medical imaging |
1.2.840.10008.1.2.4.80 | JPEG-LS Lossless | Lossless, fast |
1.2.840.10008.1.2.4.90 / .91 | JPEG 2000 (lossless only / lossy or lossless) | Wavelet compression |
1.2.840.10008.1.2.5 | RLE Lossless | Run-length encoding |
1.2.840.10008.1.2.4.102 and up | MPEG-4 AVC/H.264, HEVC/H.265 | Video, such as endoscopy or ultrasound clips |
If a viewer opens the header but shows no image, it usually doesn't support the transfer syntax. Converting to an uncompressed one, for example with DCMTK or pydicom, usually fixes it.
Privacy
Patient data and de-identification
Never publish a medical image as it is
A DICOM file from a hospital identifies the patient: name, ID, birth date, sex, the hospital, the referring doctor, dates and times, device serial numbers. The IANA registration of application/dicom says these files contain "individual demographic information" and should only travel over secure networks or inside a secure wrapper. Before sharing one outside the care setting, for teaching, research, a forum or a bug report, remove the personal data, and when in doubt don't share it.
The standard has a method for this. PS3.15 Annex E defines attribute confidentiality profiles: a table of every attribute that can identify someone and what to do with it, removing it (X), emptying it (Z), replacing it with a dummy value (D), replacing a UID consistently (U), keeping it (K) or cleaning it (C). Options cover cases such as keeping dates for longitudinal studies or cleaning descriptions. A de-identifier also records what it did, in Patient Identity Removed (0012,0062) and De-identification Method (0012,0063).
- The header is only half the job. Names and dates can be burned into the pixels themselves, for example on ultrasound screenshots or scanned documents. Annex E requires that burned-in identifying text is removed too (its Clean Pixel Data option) and that overlays and graphics are cleaned.
- Private tags can hold anything. The basic profile removes them unless they're known to be safe.
- Faces can be reconstructed from head CT and MRI scans with 3D rendering. Removing the name alone doesn't make such a scan anonymous.
- Annex E itself warns that following a profile is part of a de-identification process, not a replacement for one, and doesn't guarantee confidentiality.
Many viewers and research platforms have an anonymise function, and libraries such as pydicom and DCMTK can script the changes. Whatever you use, check the result in a viewer that shows every tag, and look at the images themselves.
How to
How to open and view DICOM files
A disc from a hospital often includes a viewer, which may only run on Windows. Free and paid alternatives:
| Viewer | Platforms | Notes |
|---|---|---|
| Weasis | Windows, macOS, Linux | Free and open source; can be launched from a web portal |
| Horos | macOS | Free and open source (LGPL), based on OsiriX |
| OsiriX MD | macOS | Paid; FDA-cleared for diagnostic use |
| MicroDicom | Windows | Free for non-commercial use |
| 3D Slicer | Windows, macOS, Linux | Free and open source; research tool with 3D rendering, segmentation and DICOM networking |
- Open a whole disc, not single files: point the viewer at the folder or the
DICOMDIRso it can group slices into series. - Adjust window and level (contrast and brightness) to see different tissues. CT values range over thousands of units; a screen shows 256 greys at a time.
- In Python:
pydicom.dcmread("image.dcm")reads the file; print it to see every element, and.pixel_arraygives the pixels as a NumPy array. - ImageMagick can read DICOM images (
magick image.dcm image.png), but it can't write DICOM, and 12- or 16-bit images may come out too dark or washed out without the right window.
Free viewers are fine for looking at your own scans. Diagnosis needs a viewer cleared or certified for medical use, on a suitable display; a converted PNG or JPEG loses information a radiologist relies on.
On the web
DICOMweb: DICOM over HTTP
Inside hospitals, DICOM files traditionally travel over DICOM's own network protocol. DICOMweb, defined in part 18 of the standard, is a set of RESTful web services for the same job:
| Service | Does |
|---|---|
| QIDO-RS | Searches for studies, series and instances |
| WADO-RS | Retrieves objects, metadata or rendered images |
| STOW-RS | Stores new objects |
| UPS-RS | Manages worklist items |
Metadata can be returned as JSON or XML instead of binary. Many web-based viewers and cloud imaging archives are built on DICOMweb, which is how a radiologist can look at a study in a browser without a .dcm file ever being downloaded as such. A browser can't open a .dcm file by itself.
How to
How to convert DICOM to JPG, PNG or video
- From a viewer: most viewers export the current image, with the window you set, as JPEG or PNG, and some export a series as a video. This is the easiest route for a presentation.
- With ImageMagick:
magick image.dcm -auto-level image.png. Fine for a quick look; it doesn't apply DICOM window settings. - With pydicom: read the file, apply the rescale slope and intercept (0028,1053 and 0028,1052) and the window you want, then save with Pillow. This gives you control over exactly what's shown.
- For research, many pipelines convert whole series to volume formats such as NIfTI, with tools like dcm2niix.
Exported JPEG or PNG files contain no DICOM header, but they can still identify someone: text burned into the image, or a face in a 3D rendering. Look at the image before sharing it.
Security
Is a DICOM file safe to open?
- Polyglot files. Because the 128-byte preamble may contain anything, a file can be a valid DICOM image and a working Windows or Linux program at the same time (CVE-2019-11687). Opening it in a viewer doesn't run it, but such a file can carry malware past filters that trust medical images. Mail and upload filters should scan DICOM files like any other executable content and check what the preamble holds.
- Parser bugs. DICOM is large and complex, and viewers and libraries have had vulnerabilities triggered by malformed files. Keep viewers updated.
- Discs with autorun viewers. Viewers on hospital discs are programs. Open discs from a source you trust, or copy the image files and use your own viewer.
- Privacy is the main risk. A DICOM file in the wrong place is a data breach. Store and send them encrypted, and de-identify before sharing.
Sample files
There are no sample DICOM files on this page. For testing software, the pydicom library (pip install pydicom) includes small test files: from pydicom.data import get_testdata_file, then get_testdata_file("CT_small.dcm") gives the path of a small CT image.
Put it online
Have a DICOM file? Give it a link.
A DICOM file put on 99helpers gets its own web address; browsers can't display .dcm files, so anyone with the link downloads it and opens it in a DICOM viewer. Only upload files without personal data: remove patient details from the header and the pixels first, and never publish a real patient's scan.
Questions
DICOM files, frequently asked
What is a .dcm file?
A DICOM file: a medical image (such as a CT slice, MRI image, X-ray or ultrasound frame) together with information about the patient, the study and the equipment.
How do I open a DICOM file on Windows or Mac?
Use the viewer on the disc you received, or a free viewer: Weasis (Windows, macOS, Linux), MicroDicom (Windows) or Horos (macOS). Open the whole folder or the DICOMDIR so the viewer can group the slices.
Can I open a DICOM file in a browser?
Not by double-clicking it. Web-based DICOM viewers exist, usually connected to an archive through DICOMweb, but a browser on its own downloads the file.
How do I convert DICOM to JPG?
Export the image from a viewer after setting the window and level, or use magick image.dcm image.jpg for a quick conversion. Check the result for names or dates burned into the image.
Why do my DICOM files have no extension?
Files on hospital CDs and DVDs follow DICOM's media rules, which limit names to 8 characters, so they're often named like IM000001 with no extension. The DICOMDIR file at the top of the disc lists them.
Is it safe to share a DICOM file?
Only after de-identification. A DICOM file normally contains the patient's name, ID, birth date and more, and the image itself can show identifying text or, for head scans, a face.
What does the DICM at byte 128 mean?
It's the signature of a DICOM file. The 128 bytes before it are a preamble that applications may use; when unused they're zero.
Related formats
Other file types explained
Keep going
Related
Sources
- DICOM PS3.10: File Meta Information (preamble, DICM prefix)
- DICOM PS3.5: Data elements and their encoding
- DICOM PS3.15 Annex E: Attribute confidentiality profiles (de-identification)
- DICOM Standard: history
- DICOM Standard: DICOMweb
- IANA: application/dicom media type (RFC 3240)
Last reviewed 27 October 2026.