Sydney's trains are being fitted with sniffing technology to catch graffiti vandals in the act.

More than 30 offenders have already been caught under the scheme, which the state government is calling "mousetrap".

"This is innovative technology," said Transport Minister Andrew Constance.

"Mousetrap is on-board technology designed to scent the vapours of permanent markers, providing real-time information with the triggering of CCTV back to Sydney Trains staff and then, of course, also real-time information being provided to the Police Transport Command," Mr Constance said.