A column-free immunoaffinity purification (CFIP) technique for sample preparation of aflatoxin B1 (AFB1) was developed using an AFB1-specific nanobody (named G8) and an elastin-like polypeptide (ELP). The reversible phase transition between liquid and solid in response to temperature changes was exhibited by the ELP which was derived from human elastin. The G8 was tagged with ELPs of various lengths (20, 40, 60, and 80 repeat units) at the C-terminus using recursive directional ligation (RDL). Coding sequences were then subcloned into pET30a at the multiple cloning sites. Bioactive recombinant proteins were produced by expressing them as inclusion bodies in Escherichia coli BL21 (DE3), then dissolved and refolded. Analysis by indirect competitive enzyme-linked immunosorbent assay (icELISA) and transition temperature (Tt) measurement confirmed that the refolded G8-ELPs preserved the ability to recognize AFB1 as well as phase transition when the temperature rose above Tt. To establish the optimal conditions for cleaning AFB1, the effects of various parameters on recovery were investigated. The recovery in ELISA tests was 95 ± 3.67% under the optimized CFIP workflow. Furthermore, the CFIP-prepared samples were applied for high-performance liquid chromatography (HPLC) detection. The recovery in the CFIP-HPLC test ranged from 54 ± 1.86% to 98 ± 3.58% for maize, rice, soy sauce, and vegetable oil samples. To the best of our knowledge, this is the first report combining the function of both nanobody and ELP to develop a cleanup technique for small molecules in a complex matrix. The CFIP for the sample pretreatment was easy to use and inexpensive. In contrast to conventional immunosensitivity materials, the reagent utilized in the CFIP was entirely biosynthesized without any chemical coupling reactions. This suggests that the nanobody-ELP may serve as a useful dual-functional reagent for the development of sample cleaning or purification methods.