PurposeIn this study, an eco-friendly cotton fabric (CF) treatment method was proposed to induce anti-ultraviolet and flame retardant properties, and a new application of tannic acid (TA) and phytic acid (PA) in ultraviolet protection and flame retardant fabric was put forward.Design/methodology/approachBy combining diethylenetriamine, PA and TA on CF, a chemical reaction intumescent flame retardant CF with anti-ultraviolet and anti-flame retardance was developed.FindingsThe flame retardant and ultraviolet resistance of CF were characterized by LOI, vertical combustion, cone calorimetry and ultraviolet resistance testing. SEM, XPS, FTIR and other tests were used to analyze the chemical composition, surface morphology and residual carbon after combustion of the CF, and it was confirmed that the modified CF has good ultraviolet resistance and flame retardant performance.Originality/valueIn this study, an eco-friendly CF treatment method was proposed to induce anti-ultraviolet and flame retardant properties, and a new application of TA and PA in ultraviolet protection and flame retardant fabric was put forward.