In this Letter, an optical hardness sensor is fabricated based on a GaN-based device combined with finger-shaped PDMS. The chip-scale 1 mm × 1 mm GaN-based device is monolithically integrated with a light emitter and receiver responsible for light emission and photodetection, respectively. The micropatterned PDMS layer can effectively convert the hardness information of the measured object into an optical change detected by the receiver. Verified by experiment measurements, the sensor exhibits a linear response in a hardness range of 1–84 HA, a sensitivity of 0.24 µA/HA, a fast response time of 1.2 ms, and a high degree of repeatability and stability. The optical sensor has the characteristics of tiny size, high compactness, inexpensive fabrication cost, wide measurement range, and high stability, making it suitable for hardness measurement in practical applications.