How to Count Cells in ImageJ and Fiji (Automatic and Manual Methods)

By Dr. Zubair Khalid, DVM, MS, PhD ·

How to Count Cells in ImageJ and Fiji (Automatic and Manual Methods)

ImageJ is a public-domain image analysis program with a history going back to NIH Image, described in the 2012 review by Schneider, Rasband and Eliceiri [8]. Fiji is a "batteries-included" distribution of ImageJ2 that bundles many plugins for scientific image analysis, builds on ImageJ2, and also includes the original ImageJ [1]. For most cell counting tasks the two behave the same way at the menu level, so the steps below apply to both.

By the end of this article you will be able to install Fiji, open a sample image, threshold it, split touching cells with Watershed, count particles automatically with Analyze Particles, and count cells by hand with the Cell Counter plugin. You will also know which settings change your count and which ones quietly corrupt your measurements.

Quick Answer

  • Download Fiji from imagej.net/software/fiji/downloads, unzip it, and start it. There is no installer [2].
  • Open your image, then set the scale with Analyze > Set Scale if you know the physical pixel size [6].
  • Convert to 8-bit with Image > Type > 8-bit, then threshold with Image > Adjust > Threshold (shortcut T) and check the red overlay before you click Apply [4].
  • Split touching cells with Process > Binary > Watershed, then count with Analyze > Analyze Particles [5][6].
  • For manual counting, use Plugins > Analysis > Cell Counter, which is included in Fiji [7].
  • Always compare counts with and without Exclude on Edges so you know how much the border is affecting your number [6].

Step 1: Install ImageJ or Fiji

Fiji is the easier starting point. It is a portable application with no installer: download the archive, unzip it, and start it [2]. On Windows, imagej.net strongly recommends storing the Fiji folder in user space, for example C:\Users\[your name]\Fiji, instead of C:\Program Files, because Windows denies Fiji write permission there and self-updates fail [2].

Windows: C:\Users\[your name]\Fiji

Fiji Latest (recommended) requires Java 21 and supports Windows 10+, macOS 11+ and Ubuntu 22.04 LTS+, on x86-64 and arm64 [1][2]. Fiji Stable is for older systems: it uses Java 8 and supports Windows XP+, Mac OS X 10.8+ and Linux x86-64, with x86-32 builds for Windows [1][2]. Those requirements were current as of October 2026, so check the download page before you install on an unusual machine.

If you only need the original ImageJ, the ImageJ 1.x download page offers bundles with Java 8, plus Zulu OpenJDK 13.0.6 for Apple Silicon Macs. The ImageJ 1.x release notes listed Version 1.54p, 17 February 2025, at the top when checked on 2026-10-01. Versions change, so confirm the current release before publishing or citing a version number.

Fiji is released under the GNU GPL; the ImageJ2 core uses the BSD 2-Clause license, and the original ImageJ is in the public domain [1]. If you use Fiji in a paper, the Fiji page asks you to cite Schindelin et al. 2012 [1][9].

Update Fiji from Help > Update [2]. Do this before a long analysis session, because plugin behavior can change between releases.

Step 2: Open an Image and Check That It Is Suitable

Use File > Open Samples to open example images hosted on the ImageJ website. The most used is blobs.gif, opened with File > Open Samples > Blobs (25K), keyboard shortcut B [3]. It is a good sandbox because you can run the whole workflow without downloading your own data.

For real work, the file format matters more than most people expect. The ImageJ User Guide states that JPEG uses lossy compression that "leads to severe artifacts that are not compatible with quantitative analyses," and that once an image is lossy-compressed there is no way to revert it [3]. Count cells from TIFF, PNG or your microscope's native format. If someone sends you a JPEG, ask for the original.

Two checks before you count anything:

  • Is the image saturated? If bright pixels are clipped at the maximum value, touching cells merge into one bright blob and thresholding will undercount them.
  • Is the background uneven? A gradient from the illumination will defeat a single global threshold. Process > Subtract Background removes smooth continuous backgrounds using a rolling ball or sliding paraboloid algorithm; the rolling ball radius should be at least as large as the radius of the largest object that is not part of the background [5].

Step 3: Calibrate the Scale

Analyze > Set Scale calibrates pixels to physical units. Draw a line selection over a known distance first, then enter Known Distance and Unit of Length; Distance in Pixels fills in from the line. The dialog also has Pixel Aspect Ratio and a Global checkbox [6].

This step decides whether your output is in square micrometers or in pixels. If you skip it, Analyze Particles reports areas in pixels, and a reviewer cannot compare your numbers to anyone else's. The Global checkbox applies the calibration to all open images, which is convenient for a plate of images captured at one magnification and dangerous if you mix magnifications in the same session.

Step 4: Convert to 8-bit and Threshold

Image > Type > 8-bit scales 16-bit and 32-bit images linearly from min-max to 0-255, respecting Edit > Options > Conversions "Scale When Converting"; RGB images are converted by averaging or by a weighted formula depending on "Weighted RGB Conversions" [4]. Many binary commands work on 8-bit images, so this conversion is a common first processing step.

Image > Adjust > Threshold (shortcut T) offers 16 automatic methods: Default (a modified IsoData), Huang, Intermodes, IsoData, Li, MaxEntropy, Mean, MinError, Minimum, Moments, Otsu, Percentile, RenyiEntropy, Shanbhag, Triangle and Yen [4]. Otsu and Default are reasonable first tries. There is no single correct method for every stain, and the method you pick changes the count.

In the Threshold dialog, "Dark background" should be checked when features are lighter than the background, for example fluorescent nuclei on a black background; the setting persists across restarts [4]. Whether you need to flip it depends on the image lookup table and the staining, fluorescent versus brightfield, so always check the red overlay preview before you commit. The overlay must cover the cells, not the background. If it covers the background, toggle Dark background.

Apply sets thresholded pixels to black and all other pixels to white; for 32-bit images it also runs Process > Math > NaN Background [4]. Apply is destructive to the working copy, so keep the original file and work on a duplicate.

One warning about a neighboring command: Brightness/Contrast on 8-bit images changes only the lookup table, with pixel values unchanged; on 16-bit and 32-bit images it changes only the display mapping; on RGB images it changes pixel values [4]. The Apply button in that dialog applies the display mapping to the pixel data, and the User Guide calls it "the only B&C option that alters the pixel data of non-RGB images" [4]. Do not press Apply there before measuring intensities.

Step 5: Clean Up the Binary Image

Process > Binary > Make Binary converts an image to black and white; if no threshold is set, it analyzes the histogram and sets an automatic threshold [5]. Process > Binary > Convert to Mask produces a black-and-white mask that uses an inverting LUT unless "Black Background" is checked in Binary Options [5]. If your mask looks inverted, that checkbox is usually the reason.

Process > Binary > Fill Holes fills holes (4-connected background elements) inside objects [5]. Use it when a cell has a dim nucleus or a vacuole that would otherwise be counted as background inside the object.

Process > Binary > Watershed "is a way of automatically separating or cutting apart particles that touch"; it computes the Euclidean distance map, finds ultimate eroded points and dilates them until they meet [5]. The User Guide notes Watershed works best for smooth, convex objects that do not overlap too much [5]. Two nuclei that share a border will often split correctly. A clump of five cells piled on each other will not, and no threshold setting will fix that.

Step 6: Count Automatically with Analyze Particles

Analyze > Set Measurements chooses which parameters Measure, Analyze Particles and the ROI Manager record, for example Area, Mean gray value, Standard deviation, Centroid, Perimeter and Circularity [6]. Set this before you run the count, because the Results table is built from these selections.

Analyze > Analyze Particles works on binary or thresholded images and outlines, measures and counts each object [6]. The Size filter ignores particles outside the range (default 0 to Infinity); units are physical square units if the image is scaled, or pixels if "Pixel units" is checked [6]. The Circularity filter uses 4pi x Area / Perimeter^2, from 0 (elongated) to 1 (perfect circle) [6].

Show options include Nothing, Outlines, Bare Outlines, Masks, Ellipses, Count Masks, Overlay Outlines and Overlay Masks [6]. Overlay Outlines is the most useful for a quick visual check: you see exactly which objects were counted.

The checkboxes are Display Results (per-particle Results table), Clear Results, Summarize, Exclude on Edges (ignore particles touching the image or selection edge), Include Holes, and Add to Manager (ROI Manager) [6]. With Summarize checked, a Summary table reports particle count, total particle area, average particle size, area fraction and the mean of the Set Measurements parameters [6].

Exclude on Edges deserves a deliberate decision. Cells cut by the image border are partial cells. Including them inflates the count with fragments; excluding them biases the count downward. Either way, state which you chose, and run the analysis both ways to see the size of the effect.

Step 7: Count Manually with the Cell Counter Plugin

Cell Counter is a Fiji plugin for manual counting, opened via Plugins > Analysis > Cell Counter; it is included in Fiji [7]. The workflow is: Initialize (creates a duplicate "counter window"), choose a counter type, then click each cell; a colored number for that type is drawn at each click [7].

Cell Counter has Add/Remove counter types, a Delete mode, Results (counts in the Results table, per slice and totals for stacks), Save/Load Markers as XML, Export Image (markers burned in) and Measure (pixel values at markers) [7]. The Save/Load Markers feature is what makes manual counting auditable: you can hand a colleague the XML file and they can see every click.

The Cell Counter page notes that the built-in Multi-point Tool now offers similar functionality, and lists known issues with 8+ counter types and screens narrower than 1024 pixels [7]. If you only need one cell type, the Multi-point Tool is lighter. With the Multi-point Tool, the point count appears in the status bar and Analyze > Measure (M) records coordinates. Manual counting is slower but it handles clumps, debris and irregular shapes that automatic thresholding cannot.

Worked Example

This uses the built-in sample, so no data download is needed.

  1. File > Open Samples > Blobs (25K) [3].
  2. Image > Adjust > Threshold, pick a method (for example Default or Otsu) and check the red overlay preview: it must cover the blobs, not the background; toggle "Dark background" if it covers the background instead, then Apply [4].
  3. Optional: Process > Binary > Watershed to split touching blobs [5].
  4. Analyze > Set Measurements: tick Area, Mean gray value, Shape descriptors as needed [6].
  5. Analyze > Analyze Particles: Size 0-Infinity (pixel units, since Blobs has no calibration), Circularity 0.00-1.00, Show: Outlines, tick Display Results, Clear Results, Summarize and Exclude on Edges [6].

The Summary table then shows Count, Total Area, Average Size, %Area and means [6]. No official imagej.net page states an expected blob count, so there is no single correct number to match. The count changes with the threshold method, with Watershed on or off, and with Exclude on Edges. Run the analysis with and without Exclude on Edges and compare the two Summary tables to see how much the border contributes.

For real cell images the order is: Set Scale first, convert to 8-bit, Subtract Background, threshold, Fill Holes or Watershed as needed, then Analyze Particles with a minimum size that rejects debris. The minimum size is a judgment call based on your cell type, and you should justify it in your methods section.

Common Mistakes and How to Fix Them

  • The count is far too high, with hundreds of tiny objects. Cause: noise or debris passing the threshold. Fix: raise the lower bound of the Size filter in Analyze Particles, and consider Process > Subtract Background first [5][6].
  • The count is far too low, and the outlines show merged clumps. Cause: touching cells counted as one object. Fix: run Process > Binary > Watershed before Analyze Particles, and check the overlay to confirm the split [5].
  • The red threshold overlay covers the background instead of the cells. Cause: the Dark background setting does not match the image. Fix: toggle "Dark background" in the Threshold dialog and re-check the preview [4].
  • The mask is inverted, with cells black on a white background when you expected the opposite. Cause: Convert to Mask uses an inverting LUT unless "Black Background" is checked in Binary Options. Fix: check that option and regenerate the mask [5].
  • Areas are reported in pixels when you expected micrometers. Cause: Analyze > Set Scale was skipped, or "Pixel units" is checked in Analyze Particles. Fix: calibrate with Set Scale, then re-run the analysis [6].
  • Intensity measurements look wrong after a contrast adjustment. Cause: the Apply button in Brightness/Contrast was pressed, which alters pixel data for non-RGB images. Fix: reopen the original file and adjust display settings without pressing Apply [4].
  • The count is unstable between runs on the same image. Cause: the threshold method or the Exclude on Edges setting changed. Fix: record both settings in your notes and keep them fixed across a dataset [6].
  • Quantification fails on a JPEG. Cause: lossy compression artifacts that cannot be reverted. Fix: re-image or request the original lossless file [3].

Limitations

Automatic counting assumes that not too many particles touch each other. The ImageJ wiki Particle Analysis page notes that automatic counting needs images where not too many particles touch. Dense cultures, tissue sections and spheroids will need manual counting or a segmentation method beyond global thresholding.

Thresholding saturated images undercounts and merges cells. If your exposure clipped the brightest nuclei, no downstream setting recovers the missing boundaries.

The ImageJ User Guide pages cited here are for ImageJ 1.46r, an old but still official guide. Menu names have been stable, but dialogs in current ImageJ 1.54x and Fiji may show extra options. When a dialog looks different from this article, trust the dialog.

Fiji system requirements, the Java 21 build versus the Java 8 build, were as of 2026-10-01 and may change. Check the download page for the current release.

A count is not a concentration. Analyze Particles returns the number of objects in the field of view. Converting that to cells per milliliter requires knowing the volume imaged, which comes from your microscope setup, not from ImageJ. If you are working from a hemocytometer instead, the Hemocytometer Cell Counter handles the chamber arithmetic.

Frequently Asked Questions

What is the difference between ImageJ and Fiji?

Fiji is a distribution of ImageJ2 that bundles many plugins and also includes the original ImageJ [1]. ImageJ on its own is the smaller, older program described in the 2012 history paper [8]. For cell counting, Fiji saves setup time because Cell Counter and other analysis plugins are already installed [7].

Where do I get ImageJ or Fiji, and which should I download?

Fiji is downloaded from imagej.net/software/fiji/downloads as a portable application: download, unzip, and start it [2]. Choose Fiji Latest unless you are on an older operating system, in which case Fiji Stable is the Java 8 build for older systems [1][2]. Check the download page for the current release before installing.

How do I use the Analyze Particles command in ImageJ?

Analyze > Analyze Particles works on binary or thresholded images and outlines, measures and counts each object [6]. Set your Size and Circularity filters, choose a Show option such as Outlines, and tick Summarize to get a count in the Summary table [6]. Run it once with Exclude on Edges and once without so you know how the border affects the result.

When should I use the Cell Counter plugin instead of automatic counting?

Use Cell Counter when cells touch heavily, when you need to distinguish two or more cell types by eye, or when debris defeats thresholding. Open it via Plugins > Analysis > Cell Counter, click Initialize, choose a counter type, and click each cell [7]. Save your markers as XML so the count can be checked later [7].

What does the Watershed command actually do?

Process > Binary > Watershed separates particles that touch by computing the Euclidean distance map, finding ultimate eroded points and dilating them until they meet [5]. It works best for smooth, convex objects that do not overlap too much [5]. If a clump is still merged after Watershed, that clump needs manual counting.

References

  1. Fiji (ImageJ wiki)
  2. Fiji Downloads (ImageJ wiki)
  3. ImageJ User Guide: File menu
  4. ImageJ User Guide: Image menu
  5. ImageJ User Guide: Process menu
  6. ImageJ User Guide: Analyze menu
  7. Cell Counter plugin (ImageJ wiki)
  8. Schneider, Rasband, Eliceiri 2012. NIH Image to ImageJ: 25 years of image analysis. Nat Methods 9:671-675
  9. Schindelin et al. 2012. Fiji: an open-source platform for biological-image analysis. Nat Methods 9:676-682

Related Articles