spectroscience.com / blog / NIR basics path / part 2
NIR basics path · Part 2 of 4What it measures, where it fails

NIR quality control in food and feed: how it works and its limits

Vitaly Kirkpatrick · first published May 11, 2025 · updated November 2026 · 11 min read

Short answer: NIR spectroscopy shines near-infrared light on a sample and reads what comes back. Water, protein, fat, starch and fibre leave clear marks in that light, so NIR measures them in seconds with no chemicals. It does poorly on anything present in trace amounts, cannot see minerals directly, and gives wrong numbers without warning when today's samples no longer look like the ones its calibration was built on.

How does NIR spectroscopy measure a food or feed sample?

Near-infrared light runs from roughly 780 to 2500 nm, just past what the eye can see. When it hits a sample of ground wheat or soybean meal, some of it is absorbed, some scatters back to the detector, and in liquids some passes through. The detector records how much light returns at each wavelength. That curve is the spectrum.

The absorption comes from chemical bonds that vibrate. Bonds between hydrogen and carbon, nitrogen or oxygen (C-H, N-H and O-H) absorb near-infrared light at overtones and combinations of their basic vibrations. Those are exactly the bonds in water, protein, fat and carbohydrates, which is why NIR fits food and feed so well. The same physics explains the weaknesses: overtone bands are weak and broad, so they overlap, and anything without those bonds, or present only in tiny amounts, barely shows.

What NIR can see in a feed sampleInteractive · simulated spectrum
The curve is a made-up spectrum of a ground feed sample. Pick a component to see where its bonds absorb and how NIR handles it. Band positions are approximate textbook regions; the shapes are simulated in your browser to show the idea, not data from a real instrument.

How does an NIR analyzer turn a spectrum into a protein number?

The instrument never measures protein. It measures light. A calibration model turns that light into a number, and the model is built by scanning a few hundred samples that were also analysed by the reference method, such as Kjeldahl or Dumas for protein or oven drying for moisture.

The usual tool is partial least squares (PLS) regression. It finds the combination of wavelengths that best tracks the reference values, while ignoring the parts of the spectrum that only add noise. Before that, the spectra are pre-treated, for example with derivatives or scatter correction, to remove effects that come from particle size rather than chemistry.

Two things follow. NIR can never be more accurate than the reference lab that taught it, and the model only knows the kinds of samples it has seen. Everything that goes wrong with NIR in a plant traces back to one of those two facts, or to how the sample was presented.

Key point

The light is real; the number is a model. When results drift, check the calibration and the sample presentation before you blame the hardware.

What does NIR measure reliably in food and feed?

The components NIR handles best are the ones present in large amounts with strong C-H, N-H or O-H bands. The further you move from that, the more care the measurement needs.

ComponentWhy NIR sees itTypical useWatch out for
Moisturestrong O-H bands near 1450 and 1940 nmgrain intake, flour, feed, dryer controltemperature changes the water bands
ProteinN-H bands, mostly 2050–2180 nmgrain payment, soybean meal, feed formulationonly as good as the Kjeldahl or Dumas reference
Fat / oilC-H bands near 1725 and 2310 nmoilseeds, meat, pet food coatinguneven fat distribution in coarse samples
Starch, fibreO-H and C-H combination bandscorn, flour, foragefibre fractions need large, varied calibration sets
Minerals (calcium, phosphorus)no NIR band of their ownforage screening at bestworks only through links to organic matter; breaks when the product changes
Mycotoxinsfar too dilute to absorb directlyresearch and rough sortingnot a replacement for immunoassay or chromatography

Where does NIR fail?

NIR loses trust fastest when it is pushed into jobs it was not built for. Four limits cover almost every case.

  • 1Trace componentsBelow roughly a percent, the signal sinks into the overlap of the big bands. Mycotoxins at parts-per-billion are far below that: screen with a validated reference method.sensitivity
  • 2Calibration coverageA model built on last year's crop or one supplier will keep showing confident numbers when the product changes. The screen gives no warning unless outlier checks are switched on.most common
  • 3Matrix effectsOther components, colour and particle size change the spectrum. A high-fibre ingredient or a dark sample the model never saw can bias the result.composition
  • 4No NIR bondsMinerals and salts have no bands. Any calcium or phosphorus prediction rides on a correlation with organic matter, which can vanish with a new ingredient.physics
When today's samples leave the calibrationInteractive · simulated data
Grey points are calibration samples; coloured points are a new batch. Move the slider to make the new material less like the calibration set, as with a new supplier or a new crop. The bias grows, and only the outlier check tells you. Simulated in your browser to show the idea; the numbers are illustrative.
Watch out

A plausible number is not a correct one. Applying one global calibration to a raw material that varies a lot is the classic way a small, steady bias slips into least-cost formulation. Keep outlier flags on and act on them.

Why does sample presentation change the result?

Many NIR errors start at the sample cup, not in the instrument. Particle size, how tightly the cup is packed, sample temperature and how the sample was taken all change the spectrum before any calibration sees it.

A glass cup of ground grain resting on the glowing sample window of a dark analyzer, with a cup of whole wheat kernels beside it
Ground and whole grain read differently. The calibration expects one grind and one fill method. Illustration, not a specific product.
  • Particle size. Coarse particles scatter light differently from fine ones. Grind to the same size the calibration used.
  • Packing. A loosely filled cup reads differently from a tapped one. Write the fill method down and train every operator on it.
  • Temperature. Water bands shift with temperature. Cold samples in winter and warm ones in summer need time to settle, or a calibration that includes both.
  • Sampling. One scoop from a truck is not the truck. A good result on a bad sample is still a bad result.
Same sample, different presentationInteractive · simulated
The dashed curve is the spectrum the calibration expects; the solid curve is what this sample presents. The predicted protein shift is illustrative, to show direction and size of effect, not data from a real instrument.
Try this first

Watch one operator run one sample, start to finish. If the steps are not written down, or two people do them differently, you have found your first NIR problem before touching the instrument.

Can NIR measure inline on a food process line?

Yes. Fibre-optic probes and non-contact heads read product in a pipe, on a conveyor or in a dryer every few seconds, and close the gap between grab samples. The trade-off is more setup and more calibration upkeep, because the process sample is never as tidy as a lab cup.

A stainless fibre-optic NIR probe fitted through the wall of a food process pipe
An inline NIR probe reads product in the pipe every few seconds, with no grab sample. Illustration, not a specific product.

If you are setting up a sensor for real-time analysis, the order matters:

  1. Pick a point where the product is well mixed and its presentation is steady: same depth, same distance, no air gaps.
  2. Collect spectra and reference samples together, at the same spot and the same moment, across the full range of product and seasons.
  3. Build the calibration from those pairs, then test it on samples it has not seen.
  4. Turn on outlier checks and decide in writing what operators do when one fires.
  5. Keep sending a few reference samples every week to catch drift early.
Try it free

Have a validation set already? Enter the standard deviation of your reference values and the SEP in the free RPD and SEP calculator: RPD of 3 or more is the usual bar for routine QC, under 2 is poor.

Worked example: a new soybean meal supplier

ILLUSTRATIVE A made-up mill to show the reasoning; not a customer case.

A feed mill measures protein in incoming soybean meal with an at-line NIR. The calibration was built on two years of meal from one crusher. Purchasing switches to a second crusher with different processing. The analyzer keeps reporting protein in the normal range, but the outlier flag starts firing on a third of the loads.

The mill sends ten of the flagged loads to the reference lab. The NIR reads about half a point high on most of them, enough to shift formulation. The fix is not a new instrument: the mill adds the new meal to the calibration set, rebuilds the model and checks it against fresh reference samples before trusting it again. The outlier check did its job; the mistake would have been switching it off because it was "noisy".

Quick check

1. An NIR analyzer shows protein in the normal range, but its outlier flag fires. What should you do?
2. Why can't NIR measure calcium directly?
3. Results drift after a new technician starts. What do you check first?
Answer the three questions above to see your score.
Where you are on the NIR basics path

Step 2 of 4: What it measures, where it fails

2 of 4 steps
  1. 1How NIR light worksLight, bonds and why NIR needs little prep.Read part 1 →
  2. 3Inside the instrumentLight source, sample interface, detector.Read part 3 →
  3. 4Molecular vibrationsOvertones and combination bands in depth.Read part 4 →

Frequently asked questions

What can NIR spectroscopy measure in food?

Components present in large amounts with C-H, N-H or O-H bonds: moisture, protein, fat and oil, starch and fibre. It measures them in seconds without chemicals, once a calibration has been built against a reference method.

How accurate is NIR for protein analysis?

It can come close to the reference lab, but never beat it, because the calibration learns from Kjeldahl or Dumas results. Accuracy depends on how well the calibration samples cover your product and on consistent sample presentation.

Can NIR detect mycotoxins?

Not at regulatory levels. Mycotoxins occur at parts-per-billion, far below what NIR can see directly. Research uses NIR for rough sorting, but compliance testing needs immunoassay or chromatography.

How do I set up an NIR sensor for real-time food analysis?

Mount it where the product is mixed and presented steadily, collect spectra and reference samples together across the full product range, build and test the calibration, switch on outlier checks, and keep sending reference samples to catch drift.

Which NIR spectrometer is best for moisture, protein and fat?

Most modern instruments handle these three well. Choose on sample type, where it will sit (lab, at-line or inline), calibration support and service, then test candidates on your own samples.

What are best practices for calibrating an NIR instrument?

Use enough samples to cover every source, season and process you expect, get good reference values, validate on samples the model has not seen, monitor outliers and bias routinely, and update the calibration when the product changes.

Next questions people ask

NIR Fundamentals course · 32 lessons

Run NIR you can trust

The course covers what NIR measures, how calibrations are built and kept honest, and how to present samples, in 32 short lessons for food, grain, feed and dairy labs. One payment, lifetime access.

Sources

  1. Pasquini, C. "Near infrared spectroscopy: a mature analytical technique with new perspectives — a review." Analytica Chimica Acta 1026 (2018): 8–36. doi:10.1016/j.aca.2018.04.004
  2. Burns, D. A., Ciurczak, E. W. (eds.). Handbook of Near-Infrared Analysis, 3rd ed. CRC Press, 2007.
  3. Ozaki, Y., Huck, C., Tsuchikawa, S., Engelsen, S. B. (eds.). Near-Infrared Spectroscopy: Theory, Spectral Analysis, Instrumentation, and Applications. Springer, 2021.
  4. Levasseur-Garcia, C. "Updated overview of infrared spectroscopy methods for detecting mycotoxins on cereals (corn, wheat, and barley)." Toxins 10, no. 1 (2018): 38. doi:10.3390/toxins10010038
  5. Clark, D. H., Mayland, H. F., Lamb, R. C. "Mineral analysis of forages with near infrared reflectance spectroscopy." Agronomy Journal 79 (1987): 485–490. doi:10.2134/agronj1987.00021962007900030016x