Integration of miniaturized elements has been a major driving force behind modern photonics. Nanowires have emerged as potential building blocks for compact photonic circuits and devices in nanophotonics. We demonstrate here a single nanowire optical correlator (SNOC) for ultrafast pulse characterization based on imaging of the second harmonic (SH) generated from a cadmium sulfide (CdS) nanowire by counterpropagating guided pulses. The SH spatial image can be readily converted to the temporal profile of the pulses, and only an overall pulse energy of 8 μJ is needed to acquire a clear image of 200 fs pulses. Such a correlator should be easily incorporated into a photonic circuit for future use of on-chip ultrafast optical technology.