The invention discloses a neural network online learning system based on a memristor. A pulse coding mode of a K-bit input vector is improved; the coding pulse corresponding to each bit is expanded into 2m pulses; In this way, the total number of needed coded pulses is K * 2m, each bit of weighted summation calculation is actually carried out for 2m times, finally, summation averaging operation iscarried out at the output end, the influence of accidental factors and noise on the calculation result in the calculation process is reduced through the mode, and therefore the calculation precisionis improved. The memristor array is simultaneously used for forward weighted summation calculation and weight small storage in the neural network; Different from offline learning, The weight in the memristor array needs to be updated once every time a signal is input through online learning, the variable quantity of the weight is mapped into the number of pulses, then the pulses are applied for one-time weight write-in operation, the neural network training speed can be increased, the hardware cost can be reduced, and the power consumption of neural network training is reduced.