Least-squares fitting is reviewed, in tutorial form, when both variables contain significant errors. Various error models are described; corresponding appropriate weighting is discussed; and the interpretation of weighting is clarified by a physically intuitive description and by graphical results. Resources in the literature on least-squares fitting that are suitable for physics and astronomy students are reviewed. Algorithms for straight-line fitting, indicate practical solution methods, are summarized and numerical comparisons are given. Also described are several readily available computer programs that allow fitting for both straight-line and nonlinear situations and that are appropriate for both research and teaching applications.