This job interview question was just banned in Massachusetts

Asking for a raise: Women vs. men
Asking for a raise: Women vs. men

Job seekers in Massachusetts will no longer have to divulge their salary history to prospective employers during an interview.

A recently-passed pay equity law requires Commonwealth employers to pay men and women equally for comparable work. It also prohibits them from asking candidates about their salary history as part of the screening process or during an interview.

"This legislation is an important step toward advancing more equal, inclusive and thriving workplaces throughout the Commonwealth for women and families," said Lt. Governor Karyn Polito, in a release Monday.

Related: Here's everything you need to know about the gender pay gap

Employers will have to wait until after they extend a formal offer, that includes compensation, to ask about a potential hire's salary history.

The law, which goes into effect July 2018, also allows workers to openly discuss their salaries without retaliation from their employer.

Supporters of the law say disclosing salary requirements can hurt the wage trajectory of women since they tend to earn less than men.

In Massachusetts, women earned 82 cents for every dollar a male earned in 2014, according to American Association of University Women.

"The gender wage gap has a real impact on the lives of women. It puts families at risk, and makes self-sufficiency in retirement more difficult," said State Auditor Suzanne Bump in a statement.

Related: Closing the gender gap could grow the economy by $2.1 trillion

On a national level, the government reports that women earn an average of about 79 cents for every dollar a man makes. It's important to note that these statistics are a broad overview comparing the wages of all full time, year-round workers, and don't take into account specifics like experience and job titles.

The gap tends to narrow (but still exists) when comparing the salaries of workers with the same job title working at similar companies and with comparable education levels and experience.

Employers are allowed to consider qualifications like experience, training and education when determining salaries under the new law.

State lawmakers passed the bill during a weekend session in July, and it was signed by Republican Governor Charlie Baker on Monday.

Personal Finance

CNNMoney Sponsors