NIR quality control in food and feed: how it works and its limits
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.
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.
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.
| Component | Why NIR sees it | Typical use | Watch out for |
|---|---|---|---|
| Moisture | strong O-H bands near 1450 and 1940 nm | grain intake, flour, feed, dryer control | temperature changes the water bands |
| Protein | N-H bands, mostly 2050–2180 nm | grain payment, soybean meal, feed formulation | only as good as the Kjeldahl or Dumas reference |
| Fat / oil | C-H bands near 1725 and 2310 nm | oilseeds, meat, pet food coating | uneven fat distribution in coarse samples |
| Starch, fibre | O-H and C-H combination bands | corn, flour, forage | fibre fractions need large, varied calibration sets |
| Minerals (calcium, phosphorus) | no NIR band of their own | forage screening at best | works only through links to organic matter; breaks when the product changes |
| Mycotoxins | far too dilute to absorb directly | research and rough sorting | not 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
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.

- 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.
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.

If you are setting up a sensor for real-time analysis, the order matters:
- Pick a point where the product is well mixed and its presentation is steady: same depth, same distance, no air gaps.
- Collect spectra and reference samples together, at the same spot and the same moment, across the full range of product and seasons.
- Build the calibration from those pairs, then test it on samples it has not seen.
- Turn on outlier checks and decide in writing what operators do when one fires.
- Keep sending a few reference samples every week to catch drift early.
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
Step 2 of 4: What it measures, where it fails
- 1How NIR light worksLight, bonds and why NIR needs little prep.Read part 1 →
- 2What it measures, where it failsYou are here.Current
- 3Inside the instrumentLight source, sample interface, detector.Read part 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
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
- 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
- Burns, D. A., Ciurczak, E. W. (eds.). Handbook of Near-Infrared Analysis, 3rd ed. CRC Press, 2007.
- Ozaki, Y., Huck, C., Tsuchikawa, S., Engelsen, S. B. (eds.). Near-Infrared Spectroscopy: Theory, Spectral Analysis, Instrumentation, and Applications. Springer, 2021.
- 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
- 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