A new decentralized synchronization algorithm achieves subnanosecond synchronization in distributed wireless sensor networks. The system is implemented completely in software, using low-cost off-the-shelf software-defined radios to quickly furnish every sensor with full information on baseband clock offsets, RF carrier phase offsets, and pairwise RF time of flight. The efficient method should support a wide range of applications, including transmit beamforming, distributed sensor localization, and coherent MIMO radar imaging for autonomous sensor swarms.