In this article, flame‐retardant cotton fabric was prepared by a step‐by‐step dip‐coating method, in which flame retardants were introduced onto the surface of the cotton fabric by hydrogen bonding association and surface grafting reaction. First, the epichlorohydrin‐modified aramid nanofibers (AEP) were accumulated onto the surface of cotton fabric (Cot/AEP) through hydrogen bond association. Subsequently, the ionic liquid (IL) was grafted onto the surface of AEP to obtain Cot/AEP/IL. The fire safe performance of cotton fabrics was investigated by the limiting oxygen index test (LOI), vertical flammability test (VFT), and cone calorimeter test (CCT), and so forth. The LOI value of Cot/AEP/IL was as high as 29.5%. The VFT results showed that Cot/AEP/IL was self‐extinguishing rather than ignited, leaving a char length of 111 mm. The CCT results demonstrated that the peak heat release rate and total heat release of Cot/AEP/IL decreased by 42.5% and 58.8% compared with untreated cotton fabrics, respectively. The TG test showed that Cot/AEP/IL had more residues left than untreated cotton under both N2 and air atmospheres. The presence of phosphorus enables the cotton fabric to generate an aromatic phosphor carbonaceous structure during the combustion process. In addition, the tensile strength of cotton fabric was tested. After the introduction of AEP/IL, the average tensile strength value of untreated cotton improved from 129 to 167 N in the warp direction and 125–155 N in the weft direction. In summary, the introduction of AEP/IL improved both the flame‐retardant and mechanical properties of the cotton fabric significantly.