The magnesium hydroxide fluorides having formula MgFx(OH)2-x with diverse Mg/F ratios were prepared by fluorolytic sol-gel method. The XRD, FT-IR, SEM, nitrogen adsorption-desorption, TG/DTG and pyridine FT-IR were performed to study properties and characteristics of samples. Based on the characterization results, the samples show dissimilar structure, thermal stability, porosity, surface acidity and morphology. In addition, the average pore diameter and total pore volume of the MgFx(OH)2-x decrease with increase in fluorine contents. The activity of solids as heterogeneous catalyst for production of biodiesel from used frying oil exhibits that MgFx(OH)2-x with Mg/F ratio of 1:2 gives higher yield of biodiesel (75.29 %) compared to MgFx(OH)2-x (x < 2). The higher activity of MgFx(OH)2-x (x = 2) catalyst for biodiesel production can be attributed to acid sites (Lewis and Brønsted), average pore diameter and total pore volume. Moreover, performance of catalyst decreases after three cycles.