The invention discloses a formation interface real-time extraction method based on while-drilling azimuth electromagnetic wave logging data. The formation interface real-time extraction method comprises the steps that s1, sliding windowing is conducted on the logging data of a large-slope well/a horizontal well; s2, if shallow detection geological signals exist, the s3 is executed, and otherwise the s5 is executed; s3, single-interface inversion is conducted through the shallow detection geological signals; s4, the optimal solution of the single-interface inversion is input into the s7 to be used as known constraint; s5, a dual-interface inversion model is established; s6, whether proximity interface information exists or not is judged, if yes, the s7 is executed, and otherwise the s8 is executed; s7, multi-initial-value selection is conducted on far formation interface positions and far surrounding rock resistivity in the model in the s5, and then the s9 is executed; s8, multi-initial-value assignment is conducted on all to-be-inverted parameters in the model in the s7; s9, on the basis of deep detection geological signals, the optimal solution of double-interface inversion is obtained; and s10, real-time imaging processing is conducted on inversion results. According to the formation interface real-time extraction method, fast and accurate interface information can be provided for real-time geological guidance.