The invention relates to medicine and cosmetology. According to a first embodiment, a composition in the form of a gel for treating or preventing hair loss contains: 0.08-0.8% unfractionated heparin salt, 0.15-3% lipid nano - complex emulsion, 0.5-2% thickener, 0.1-0.2% emulsifier, 0.03-1. 3% neutralizing agent, 0.01-0.03% preservative, the remainder being water or a polyol. According to a second embodiment, a composition in the form of a gel for treating or preventing hair loss contains: 0.08-0. 8% unfractionated heparin salt, 0.15-3% lipid nanocomplex emulsion, 0.005- 0.02% peptide nanocomplex solution, 0.05-3% thickener, 0.1-0.2% emulsifier, 0.03- 1.3% neutralizing agent, 0.01- 0.03% preservative, the remainder being water. According to a third embodiment, a composition in the form of a gelcream for treating or preventing hair loss contains: 0.08-0. 8% unfractionated heparin salts, 3-5% lipid nanocomplex emulsion, 0.05-3% thickener, 0.03-1 .3% neutralizing agent, 0.01-0.03% preservative, 12-15% oils, 3-4% emulsifier, the remainder being water. According to a fourth embodiment a composition in the form of a gel-cream for treating or preventing hair loss contains: 0.08-0. 8% unfractionated heparin salts, 3-5% lipid nanocomplex emulsion, 0.005-0.02% peptide nanocomplex solution, 0.05-3% thickener, 0.03-1 .3% neutralizing agent, 0.01-0.03% preservative, 12-15% oils, 3- 4% emulsifier, the remainder being water. The method for treating or preventing hair loss caused by alopecia consists in the topical application to the area of hair loss of the above-mentioned compositions, selected according to the duration and extent of hair loss. The technical result is an increase in the range of means for treating hair loss (for example androgenic alopecia) without side effects.