The ionospheric anomalies before an earthquake may be related to earthquake preparation. The study of the ionospheric anomalies before an earthquake provides potential value for earthquake prediction. This paper proposes a method for detecting ionospheric total electron content (TEC) anomalies before an earthquake, taking the MS 7.8 earthquake in Türkiye on 6 February 2023 as an example. First, the data of four ground-based GNSS stations close to the epicenter were processed by using the sliding interquartile range method and the long short-term memory (LSTM) network. The anomaly dates detected by the two methods were identified as potential pre-earthquake TEC anomaly dates after eliminating solar and geomagnetic interference. Then, by using the sliding interquartile range method to process and analyze the CODE GIM (Center for Orbit Determination in Europe, Global Ionospheric Map) data from a global perspective, we further verified the existence of TEC anomalies before the earthquake on the above TEC anomaly days. Finally, the influence of the equatorial ionospheric anomaly (EIA) on the TEC anomaly disturbance was excluded. The results show that the ionospheric TEC anomalies on January 20, January 27, February 4, and February 5 before the Türkiye earthquake may be correlated with the earthquake.