The performances of optical and radio frequency communication systems are compared for long distance applications, such as deep space communications, where the signal-to-noise ratio (SNR) is crucial. We compare an optical communication system operating at 0.8 μm using intensity modulation and direct detection with an avalanche photodiode, an optical communication system operating at 1.5 μm using on-off keying and an optical preamplifier, and a radio frequency communication system operating in the X band. Assuming typical system parameters for the link budget analysis, we find that for distances between the transmitting and receiving antennas (R) of 107 km, the SNR for the optical systems is proportional to R-4, while for the radio frequency system it is always proportional to R-2. The maximum data rate achievable with the radio frequency system is higher than that with the optical systems for distances beyond 108 km. For near-Earth communication links, an optical system with optical preamplification is preferable when the data rate is higher than several gigabits per second. Clearly our results are based on specific system parameters. However, the equations involved and the method of comparison will be applicable for a wide range of system parameters.