People who share non-consensual, digitally altered sexual images will face six years behind bars while those who created the image face seven under an aggravated offence.
People who have engaged in similar conduct under a civil offence three times will also face seven years with a new separate aggravated offence.
The new laws, which passed parliament on Wednesday, cover the non-consensual sharing of real images as well, but were brought in to close gaps in the system opened up by deepfakes.
Deepfakes are digitally altered images of a person or their body, including being superimposed onto pornography.
There has been an exponential increase in these images, spurred by technology developments and artificial intelligence making their creation easier.
Between 90 and 95 per cent of deepfakes were non-consensual pornography and 99 per cent of deepfake victims were women, an inquiry into the bill heard.
"The new criminal offences are based on a consent model to better cover both artificial and real sexual material," Labor frontbencher Murray Watt told the Senate on Wednesday.
Consent was based on free and voluntary agreement, Senator Watt said.
Shadow attorney-general Michaelia Cash warned of unintended consequences of the laws, including how the victims of the harassment could face cross-examination in court.
The Commonwealth Director of Public Prosecutions said the legislation addressed a gap where complaints from victims where their face was superimposed onto sexual material may not be covered under the criminal code.
Apps allowing for the creation of such content had become mainstream which was why the new criminal penalties were needed, eSafety Commissioner Julie Inman Grant said.
Independent senator David Pocock warned of the risks deepfakes posed to democracy, including through the spread of misinformation during elections.
His amendment calling on the government to ban the use and transmission of deepfakes in political advertising was rejected by Labor and the coalition.
It was outside the scope of the bill but the government remained committed to improving election transparency and tackling misinformation, Senator Watt said.
The Greens pushed to explicitly criminalise the creation of non-consensual deepfakes and threats to create them as standalone offences.
The government argued such offences remained the remit of the states and territories and not within the Commonwealth's jurisdiction.
The nation's attorneys-general are working on harmonising laws.
Lifeline 13 11 14
Kids Helpline 1800 55 1800 (for people aged 5 to 25)