Abstract Optical logic gates based on nonlinear optical property of material with ultrafast response speed and excellent computational processing power can break the performance bottleneck of electronic transistors. As one of the layered 2D materials, Ta2NiS5 exhibits high anisotropic mobility, exotic electrical response, and intriguing optical properties. Due to the low-symmetrical crystal structures, it possesses in-plane anisotropic physical properties. The optical absorption information of Ta2NiS5 is investigated by anisotropic linear absorption spectra, femtosecond laser intensity scanning (I-scan), and non-degenerate pump-probe technology. The I-scan results show a distinct maximum of ∼4.9 % saturable absorption (SA) and ∼4 % reverse saturable absorption (RSA) at different polarization directions of the incident laser. And, these unique nonlinear optical (NLO) properties originate from the anisotropic optical transition probability. Furthermore, the novel Ta2NiS5-based all-optical logic gates are proposed by manipulating the NLO absorption processes. And, the all-optical OR and NOR logic gates possess an ultrafast response speed approaching 1.7 THz. Meanwhile, an all-optical information transmission method with higher security and accuracy is achieved, which has promising potential to avoid the disclosure of information. This work provides a new path for designing versatile and novel optical applications based on Ta2NiS5 materials.