Ofloxacin (OFL), as third generation fluoroquinolone antibiotics, is commonly used to treat bacterial infections in humans and animals. However, excessive use of OFL has led to significant environmental contamination, raising concerns about food safety and public health. The current detection methods for OFL residues are often limited by excessive operational complexity, high resource consumption, and constrained application scope, highlighting an urgent need for more efficient and accessible alternatives. In this work, we developed a simple and fast fluorescence aptasensor for detecting OFL based on FRET (Förster Resonance Energy Transfer) between the FAM fluorescent group and gold nanoparticles (AuNPs). The nucleic acid aptamer labeled with FAM (FAM-Apt) binds with the AuNPs to quench FAM fluorescence due to FRET. Upon addition of OFL, OFL preferentially binds with aptamers, leading to fluorescence intensity of FAM-Apt increase. Therefore, this strategy provided the possibility for OFL detection. The results showed that this sensor can selectively detect OFL with a linear range of 0-1500 nM. The limit of detection was detected to be 4.84 nM under optimized conditions. The sensor can be used for detecting OFL in serum, urine, tap-water, river water, pork, chicken and milk with spiked recoveries ranged from 98.00–102.56% and relative standard deviations ranging from 0.41–6.99%. These results demonstrate that this aptasensor offers an accurate, widely applicable potential for OFL monitoring, addressing critical needs in public health and environmental safety by providing an effective method for OFL residue detection in environmental and food samples.