The transient electromagnetic method (TEM) has been widely used as a geophysical exploration method in recent years. When Maxwell's equations are discretized in the time domain by the direct solution method, the initial field is used as a substitute for the source, so the electromagnetic response of a shallow three-dimensional anomalous body cannot be calculated. Maxwell's equations in the frequency domain are simple in form, and the current source can be directly added without calculating the initial field. However, large linear equations must be calculated. The coefficient matrix is large, and the calculation speed is slow, which limits their application. Based on Yee grids, this paper combines octree grids with the finitedifference frequency-domain (FDFD) method. Ensuring a sufficiently large computational area, octree grids are used to refine the area of anomalous bodies, while coarse grids are still used to reduce the total number of grids and improve the efficiency. In the numerical simulation, the vacancy positions are set to zero to solve the data storage problem of the coarse grids and fine grids. The binary paraboloid interpolation method is used to solve the electromagnetic field component transfer problem at the intersection of the coarse grid and fine grid. Finally, the electromagnetic response curve in the time domain is obtained by a frequency-time transformation. By comparing the calculation results of typical models, the correctness of the FDFD method based on octree grids is verified. By comparing the computational time of complex anomalous bodies for Yee grids and octree grids, it can be concluded that the efficiency of the FDFD method based on octree grids is improved to a certain extent. INDEX TERMS Finite-difference frequency-domain (FDFD), frequency-time transformation, numerical simulation, octree grids, transient electromagnetic method (TEM).