New technology that can detect when graffiti vandals are tagging train cars is being heralded in Australia as a major breakthrough in crime prevention.

The electronic sensor, called a "mousetrap," has been tested across the network and has so far led to the arrest of 30 people.

It works by detecting the vapours of spray cans and markers while they are in use and alerting transport authorities and police.

Australian Transport Minister Andrew Constance said it was a useful tool.

"What this means is that those who commit graffiti can now be caught immediately, with can in hand, marker in hand, doing the damage," he said.

"[Mousetrap] provides real-time information, triggering closed-circuit TV back to Sydney Trains staff and also real-time information provided directly to the Police Transport command."

Sydney Trains declined to say how many of the devices would be rolled out across the network but indicated they would be randomly moved from different train lines.

Removing graffiti cost taxpayers $34 million last financial year, up from $30 million the year before.

Sydney Trains chief executive Howard Collins said it was a big problem.

"Our customers hate it – it's one of the top customer complaints and cleaners work hard to remove about 11,000 tags from trains each month," he said.

"We know customers feel unsafe when they are using a train which is covered in graffiti and offenders often place themselves and others in danger by trespassing on the railway or being somewhere they shouldn't.

"When I came to Sydney 10 years ago most of the trains had graffiti inside and out. We now work on keeping our trains clean."