Precise position information is considered as the main enabler for the implementation of smart manufacturing systems in Industry 4.0. In this article, a time-of-flight based indoor positioning system for LiFi is presented based on the ITU -T recommendation G.9991. Our objective is to realize positioning by reusing already existing functions of the LiFi communication protocol which has been adopted by several vendors. Our positioning algorithm is based on a coarse timing measurement using the frame synchronization preamble, similar to the ranging, and a fine timing measurement using the channel estimation preamble. This approach works in various environments and it requires neither knowledge about the beam characteristics of transmitters and receivers nor the use of fingerprinting. The new algorithm is validated through both, simulations and experiments. Results in an 1m × 1m × 2m area indicate that G.9991-based positioning can reach an average distance error of a few centimeters in three dimension. Considering the common use of lighting in indoor environments and the availability of a mature optical wireless communication system using G.9991, the proposed LiFi positioning is a promising new feature that can be added to the existing protocols and enhance the capabilities of smart lighting systems further for the benefit of Industry 4.0.