ABSTRACTIndoor localization plays an important role in medical treatment and industrial application. Dual-frequency phase-comparison method is widely applied to indoor localization. However, frequency was randomly chosen in most current dual-frequency phase-comparison schemes, which reduced the ranging accuracy. Therefore, an IL-ODFC (indoor localization scheme based on optimal dual-frequency comparison ranging) scheme was proposed. An indoor localization system and a wireless sensor nodes based on dual-phase measurement were designed and established in order to form target nodes and reference nodes and send their communication results to the location engine of indoor localization system. Firstly, reasons for errors of traditions dual-frequency phase-comparison ranging in IL-ODFC scheme was analyzed; then, the concept of frequency domain and one-time linear regression idea was introduced; next, LS (least square) method was used to choose optimal difference frequency in order to obtain accurate ranging data. After obtaining distances among three reference nodes, LS was used to estimate the location of the target nodes. The simulation result shows that the proposed IL-ODFC scheme can effectively improve location accuracy.