Since the diode is one of the common electronic components in modern semiconductor electronics, realizing diodes with superior and controllable rectifying behaviors based on two-dimensional materials is important for next-generation electronics. Herein, gate-tunable in-plane (IP) and out-of-plane (OP) heterojunction diodes composed of the semiconductive WGe 2 N 4 and metallic TaSi 2 N 4 are reported based on first-principles calculations. The interfacial properties and rectifying characteristics of the IP and OP heterojunction diodes are systematically investigated. The results demonstrate that the Schottky barrier in the IP diode is much larger than that in the OP diode, resulting in a smaller current of the IP diode. The IP diode exhibits a much higher rectification ratio of 10 7 than the OP diode of 10 4 under the zero gate voltage. Noticeably, the rectifying behaviors of both diodes can be effectively modulated by the gate voltages. The positive gate voltages increase the current of IP and OP Schottky diodes and improve the rectification ratio to 10 9 and 10 5 , respectively. Moreover, the negative gate voltage makes the rectifying direction of the OP Schottky diode reverse with a rectification ratio larger than 10 6 . Our results provide a reference for designing superior twodimensional diodes with controllable rectifying behaviors and pave the way for the design of logic devices in the future. KEYWORDS: in-plane and out-of-plane heterojunction diodes, gate-tunable, rectifying behavior, first-principles calculations, WGe 2 N 4 , TaSi 2 N 4