Egypt had already doubled to one kilometre (0.62 mile) the depth of a security buffer zone on its border with the Gaza Strip after some of the worst anti-state violence since President Mohamed Morsi was overthrown by the army following mass protests against his rule in 2013.
Authorities are still battling an insurgency in which the most active group, Sinai Province, has pledged allegiance to Islamic State. Hundreds of police and soldiers have been killed in the attacks, which have surged since the army ousted Morsi.
President Abdel Fattah al-Sisi has described Islamist militant groups as an existential threat to Egypt, the most populous Arab country.
The trench would help detect more tunnels used in the smuggling trade, which Egyptian authorities see as a threat. Once the trench is dug, no vehicle or person will be able to pass except through the trench.
Security sources said passages had been made for vehicles and for pedestrians. They said the U-shaped trench is two kilometres away from the border and will have a depth of 20 metres and a width of 10 metres.
Egypt has kept its Rafah closing with Gaza largely shut since 2013 but has recently opened it for a few days. The Sinai Peninsula is a strategic region that borders Israel, Gaza and the Suez Canal.
Cairo has accused Hamas of helping militants in Egypt's Sinai desert, which borders Gaza, to attack its security forces. Hamas denies this.
But an Egyptian court earlier this month canceled a previous ruling labelling Hamas a terrorist group, a decision that was praised by Palestinian Islamists.
Some residents criticized the trench, saying it had choked traffic and had caused the destruction of vegetation, which many farmers in the area depend on.