This paper presents a sound-based online localization method for an in-pipe snake robot with an inertial measurement unit (IMU). In-pipe robots, in particular, snake robots need online localization for autonomous inspection and for remote operator supports. The GPS is denied in a pipeline, and conventional odometry-based localization may deteriorate due to slippage and sudden unintended movements. By putting a microphone on the robot and a loudspeaker at the entrance of the pipeline, their distance can be estimated by measuring the time of flight (ToF) of a reference sound emitted from the loudspeaker. Since the sound propagation path in the pipeline is necessary for estimating the robot location, the proposed sound-based online localization method simultaneously estimates the robot location and the pipeline map by combining the distance obtained by the ToF and orientation estimated by the IMU. The experimental results showed that the error of the distance estimation was less than 7% and the accuracy of the pipeline map was more than 68.0%.