NSW senator David Leyonhjelm has been accused of telling the Greens' Sarah Hanson-Young to "stop shagging men" and then swearing at her when she confronted him in federal parliament.

Senator Hanson-Young told the Senate the Liberal Democrats senator made the remark on the floor of the upper house during a division on a motion about arming women with tasers to combat violence.

READ MORE: Attackers to be barred from questioning domestic violence survivors in court

"I asked whether I heard him correctly. He confirmed he yelled, 'You should stop shagging men, Sarah'," Senator Hanson-Young said.

"Shocked, I told him he was a creep. His reply was to tell me to 'f... off'."

She said Senator Leyonhjelm refused to apologise for the comments, which she says are offensive and sexist.

Greens leader Richard Di Natale has approached Senate President Scott Ryan over the incident.

Senator Hanson-Young said it was a sexist slur against her.

I have formally put this event on the record in the Senate and asked Senator Leyonhjelm to withdraw his comment and apologise directly. — Sarah Hanson-Young💚 (@sarahinthesen8) June 28, 2018

"This slur was yelled across the chamber during a vote on a motion about violence against women - namely, to arm women with pepper spray and tasers to prevent men from raping them," she said in a Facebook post.

"This is sexism, and it's wrong."

Senator Leyonhjelm said he was responding to Senator Hanson-Young's interjection, which was "along the lines of all men being rapists".

"I responded by suggesting that if this was the case she should stop shagging men. I did not yell at her," Senator Leyonhjelm said.

"Following the division, Senator Hanson-Young approached me and called me a creep. I told her to f*** off."

He said if the Greens senator took offence, it was an issue for her.

"I am prepared to rephrase my comments. I strongly urge Senator Hanson-Young to continue shagging men as she pleases," Senator Leyonhjelm said.