Physical unclonable functions (PUFs) utilize uncontrollable manufacturing randomness to yield cryptographic primitives. Currently, the fabrication of the most generally employed optical PUFs mainly depends on fluorescent, Raman, or plasmonic materials, which suffer inherent robustness issues. Herein, we construct an optical PUF with high environmental stability via total internal reflection (TIR-PUF) perturbed by randomly distributed polymer microspheres. The response image is transformed into encoded keys via an iterative binning procedure. The concentration of the polymer solution is optimized to debias the bit nonuniformity and maximize encoding capacity. The constructed TIR-PUF shows significantly high encoding capacity (2370) and markedly low total authentication error probability (1.614 × 10-23). The intra-Hamming distance is as low as 0.068, indicating the excellent readout reliability of TIR-PUF. The environmental stability of TIR-PUF has demonstrated promising results under a range of challenging conditions such as ultrasonic washing, high temperature, ultraviolet irradiation, and severe chemical environments. Moreover, the challenge-response pairs of our TIR-PUFs are demonstrated on an authentication system with low-power dissipation, lightweight components, and wireless imaging capture, rendering the possibility of portable authentication for practical applications.