We have compared structured and unstructured grid-based 2D inversion algorithms for magnetotelluric (MT) and radiomagnetotelluric (RMT) data in terms of speed and accuracy. We have developed a new 2D inversion algorithm for MT and RMT data by using a finite-element (FE) method that uses unstructured triangle grids. We compare the inversion results of our unstructured grid-based algorithm with those of the conventional algorithm, which uses either a structured FE or structured finite-difference (FD) numerical solution technique. The imaging of the surface topography and the underground resistivity structures by the new algorithm requires fewer elements than those that use FE and FD structured grids. We also find that when unstructured grids are used, the quality of the mesh is increased and the numerical errors are significantly reduced. Thus, the program runs faster and can simulate the complex surface topography in a more stable setting than the classic inversion algorithms. Furthermore, we implement a new smoothing matrix format for the unstructured triangle grids for the inversion procedure. We use two samples of synthetic data for the MT and RMT frequencies as well as a sample of field RMT data collected across a fault zone for comparison. In our synthetic data experiment, we find that the resistivity values and the boundaries obtained from the inversion of the unstructured mesh are closer to those of the true a priori synthetic model. Results of the synthetic and field data verify the computational advantages (speed and accuracy) of our inversion algorithm with respect to the conventional structured grid-based inversion algorithms.