Aflatoxin M1 nanobody 2014AFM-G2 has the amino acid sequence of SEQ ID NO:7, and is encoded by the gene sequence of SEQ ID NO:8. The aflatoxin M1 nanobody 2014AFM-G2 obtained via screening has the properties of tolerance to organic reagents, tolerance to high temperature, tolerance to acids and bases and the like, and good stability. The aflatoxin M1 nanobody 2014AFM-G2 has 50% inhibiting concentration IC50 to aflatoxin M1 of 0.208 ng/mL, and has cross reaction rates with aflatoxin B1, B2, G1, G2 are 9.43%, 5.93%, 4.87% and 6.17%, respectively.