In this study, a robust 1D inversion was performed on magnetotelluric (MT) data by utilizing the Huber loss function to avoid misleading interpretation of results, which is caused by the presence of outliers in the data. The MT method utilizes the ratio between the electric field (E) and the magnetic field (H), which are perpendicular to each other, to obtain impedance values (Z). These values are used to extract subsurface information in the form of electrical resistivity variations with depth. In the study, forward modeling of the 1D MT responses was conducted by recursively calculating Z values. Robust inversion was performed using the Huber loss function as an objective function to minimize the difference between the calculated and observed data. The Huber loss function combines the squared loss and the absolute loss to anticipate the presence of outliers in MT observation data. The robust inversion was performed on synthetic data with additional noise and field data. The inversion process utilized 50 layers with a thickness of 500 m, a hyperparameter $$\varvec{\delta }= 5\times {10}^{-2}$$
δ
=
5
×
10
-
2
, $$\lambda =0.01$$
λ
=
0.01
, and $${\lambda }_{t}=100$$
λ
t
=
100
. The number of iterations used was 500 for inversions that used synthetic data and 3000 for inversions that used field data. The robust inversion scheme using the Huber loss function successfully overcame the presence of outliers and accurately estimated the actual model parameters, both for synthetic data and field data that contained outliers. The misfit was relatively small and close to zero, indicating that the inversion code works well.