The reliable detection, sizing, and sorting of viruses and nanoparticles is important for biosensing, environmental monitoring, and quality control. Here we introduce an optical detection scheme for the real-time and label-free detection and recognition of single viruses and larger proteins. The method makes use of nanofluidic channels in combination with optical interferometry. Elastically scattered light from single viruses traversing a stationary laser focus is detected with a differential heterodyne interferometer and the resulting signal allows single viruses to be characterized individually. Heterodyne detection eliminates phase variations due to different particle trajectories, thus improving the recognition accuracy as compared to standard optical interferometry. We demonstrate the practicality of our approach by resolving nanoparticles of various sizes, and detecting and recognizing different species of human viruses from a mixture. The detection system can be readily integrated into larger nanofluidic architectures for practical applications.