The paper presents an inversion procedure that derives the temperature stratification, the turbulent velocity, and the magnetic field strength of the photospheric layers of small-scale magnetic fields from observed Stokes V spectra and the continuum intensity. The inversion is based on the determination of a small number of model flux parameters by a nonlinear least squares fitting algorithm. The minimization of the sum of the squared differences between observed and synthetic observables makes it possible to determine the temperature stratification and the magnetic field strength.