The invention discloses a filtering algorithm for ripple detection of a vehicle window controller. The filtering algorithm comprises the following steps: step 1, ripple sampling; 2, setting parameters; step 3, formulating rules; step 4, initializing a filter; step 5, waveform judgment; step 6, waveform rising; step 7, waveform declining; step 8, interference judgment; ripple data are sampled in real time through the single-chip microcomputer MCU, meanwhile, the collected ripple data are subjected to filtering calculation in a segmented mode, the ripple period and the ripple amplitude are output to the anti-pinch controller in real time, the anti-pinch performance of the car window is improved, the speed of the segmented calculation method is high, the filtering efficiency is greatly improved, and the anti-pinch performance of the car window is improved. Filtering results are continuously output in real time in the whole process of vehicle window movement, the last S pieces of data of each set of sampling data are reserved during filtering to serve as filtering initial data of the next set, smooth connection of the filtering data between two adjacent time periods is guaranteed, and interference noise introduced by segmented calculation can be eliminated.