Raman spectroscopy is a real-time, non-contact, and non-destructive technique able to obtain information about the composition of materials, chemicals, and mixtures. It uses the energy transfer properties of molecules to detect the composition of matter. Raman spectroscopy is mainly used in the chemical field because background fluorescence and instrumental noise affect biological (in vitro and in vivo) measurements. In this method, we describe how hardware related artifacts and fluorescence background can be corrected without affecting signal of the measurement. First, we applied manual correction for cosmic ray spikes, followed by automated correction to reduce fluorescence and hardware related artifacts based on a partial 5th degree polynomial fitting and Tophat correction. Along with this manuscript we provide a MatLabⓇ script for the automated correction of Raman spectra.•"Polynomial_Tophat_background_subtraction _methods.m" offers an automated method for the removal of hardware related artifacts and fluorescence signals in Raman spectra.•"Polynomial_Tophat_background_subtraction _methods.m" provides a modifiable MatLab file adjustable for multipurpose spectroscopy analysis.•We offer a standardized method for Raman spectra processing suitable for biological and chemical applications for modular confocal Raman spectroscopes.