In the advancement of photonics technologies, all-optical systems are highly demanded in ultrafast photonics, signal processing, optical sensing and optical communication systems. All-optical devices are the core elements to realize the next generation of photonics integration system and optical interconnection. Thus, the exploration of new optoelectronics materials that exhibit different optical properties is a highlighted research direction. The emerging two-dimensional (2D) materials such as graphene, black phosphorus (BP), transition metal dichalcogenides (TMDs) and MXene have proved great potential in the evolution of photonics technologies. The optical properties of 2D materials comprising the energy bandgap, third-order nonlinearity, nonlinear absorption and thermo-optics coefficient can be tailored for different optical applications. Over the past decade, the explorations of 2D materials in photonics applications have extended to all-optical modulators, all-optical switches, an all-optical wavelength converter, covering the visible, near-infrared and Terahertz wavelength range. Herein, we review different types of 2D materials, their fabrication processes and optical properties. In addition, we also summarize the recent advances of all-optical modulation based on 2D materials. Finally, we conclude on the perspectives on and challenges of the future development of the 2D material-based all-optical devices.