Knowledge on the thickness, composition, and interfaces of thin films and multilayers is, in many systems, fundamental for the understanding and optimization of their properties. One of the techniques often applied to such studies is Rutherford backscattering (RBS). However, it has been very difficult to account for the effects of interface roughness in the data obtained, and the alternative has been to develop dedicated data analysis codes for particular problems where roughness plays a determinant role. In this work, the effect of roughness is taken into account in the data analysis by calculating the effect of roughness on the apparent energy resolution as a function of depth. This depends on the exact type of roughness, and three different models have been implemented: inhomogeneous layer thickness, corrugated sample, and rough substrate surface. Interfacial mixing in multilayers can also be analysed with the method developed. Automatic fits to the data can be performed in this way, where the roughness parameters are derived during the fit, providing a new tool for RBS analysis. The code is applied to several systems in order to test its validity and applicability. Systems which are hard to analyse by RBS have been chosen: Si/VS/Si 0.65 Ge 0.35 300 nm/Si 0.2 Ge 0.8 4 nm/Si 0.65 Ge 0.35 15 nm/Si 3 nm thin films, where VS stands for a linearly composition-graded virtual substrate; and MgO/(Fe 25 Å/Co 20 Å) 10 multilayers.