An optical transmitting and receiving unit includes: an optical transmitting module having a light emitting element and having a metal case that stores the light emitting element; an optical connector having a ferrule for holding an optical fiber and having a flange portion provided at one end of the ferrule, the ferrule being inserted into a sleeve of the metal case to connect the optical connector with the optical transmitting module; and a tubular waterproof cap that has a bottom, with one end open and the other end closed, and caps the optical connector to seal an optical connecting portion between the optical connector and the optical transmitting module in a watertight manner. The metal case has step portions with different outside diameters. One of the step portions closest to the optical connecting portion contacts an inner surface of the waterproof cap along an entire circumference thereof.