Polymer microparticles with unique, decodable identities are versatile information carriers with a small footprint. Widespread incorporation into industrial processes, however, is limited by a trade-off between encoding density, scalability and decoding robustness in diverse physicochemical environments. Here, we report an encoding strategy that combines spatial patterning with rare-earth upconversion nanocrystals, single-wavelength near-infrared excitation and portable CCD (charge-coupled device)-based decoding to distinguish particles synthesized by means of flow lithography. This architecture exhibits large, exponentially scalable encoding capacities (>10(6) particles), an ultralow decoding false-alarm rate (<10(-9)), the ability to manipulate particles by applying magnetic fields, and pronounced insensitivity to both particle chemistry and harsh processing conditions. We demonstrate quantitative agreement between observed and predicted decoding for a range of practical applications with orthogonal requirements, including covert multiparticle barcoding of pharmaceutical packaging (refractive-index matching), multiplexed microRNA detection (biocompatibility) and embedded labelling of high-temperature-cast objects (temperature resistance).