The history of same-sex marriage in Australia includes its express prohibition by the Howard government in 2004 and its eventual legalisation by the Parliament in December 2017. Although a same-sex marriage law was passed by the Australian Capital Territory in 2013, it was struck down by the High Court on the basis of inconsistency with federal law. The Court's decision closed the possibility of concurrent state or territory laws that would allow same-sex marriage where federal law did not. A law legalising same-sex marriage passed the Parliament on 7 December 2017 and received royal assent the following day.

Between September 2004 and October 2017, there were 22 unsuccessful attempts in the Federal Parliament to legalise or recognise same-sex marriage under federal law. Former Prime Minister Malcolm Turnbull supported same-sex marriage during his time in office when same-sex marriage was legalised by the Parliament. The Turnbull government went to the 2016 federal election with a policy to put the issue of same-sex marriage to a plebiscite, and was narrowly re-elected, though the legislation to establish the plebiscite was rejected by the Australian Senate in November 2016 and again in August 2017.

Consequently, the government conducted a voluntary postal survey between 12 September and 7 November 2017, ascertaining the views of Australians on legislating for same-sex marriage. The survey did not require parliamentary approval and despite being legally challenged, was upheld by the High Court. The government pledged to facilitate the passage of a private member's bill legalising same-sex marriage in the Parliament if a majority of respondents voted "Yes" in the survey. The results of the survey were announced on 15 November 2017; 61.6% of respondents voted for same-sex marriage.

Federal law + Bills introduced to allow or recognise same-sex marriages under federal law No Title 1 Same Sex Relationships (Enduring Equality) Bill 2004 2 Same-Sex Marriages Bill 2006 3 Marriage (Relationships Equality) Amendment Bill 2007 4 Marriage (Relationships Equality) Amendment Bill 2008 5 Same-Sex Marriages Bill 2008 6 Marriage Equality Amendment Bill 2009 7 Marriage Equality Amendment Bill 2010 8 Marriage Amendment Bill 2012 9 Marriage Equality Amendment Bill 2012 10 Marriage Amendment Bill (No. 2) 2012 11 Marriage Equality Amendment Bill 2013 12 Marriage Act Amendment (Recognition of Foreign Marriages forSame-Sex Couples) Bill 2013 13 Marriage Equality Amendment Bill 2013 14 Recognition of Foreign Marriages Bill 2014 15 Freedom to Marry Bill 2014 16 Marriage Amendment (Marriage Equality) Bill 2015 17 Marriage Legislation Amendment Bill 2015 18 Marriage Amendment (Marriage Equality) Bill 2016 19 Marriage Equality Amendment Bill 2013 20 Marriage Legislation Amendment Bill 2016 21 Marriage Legislation Amendment Bill 2016 [No. 2] 22 Freedom to Marry Bill 2016 23 Marriage Amendment (Definition and Religious Freedoms) Bill 2017

The following details the legislative history of marriage law and reform attempts in federal parliament.

23rd Parliament (1959–1961) Previously a matter for the Australian states and territories, uniform national marriage legislation was first introduced by Attorney-General Garfield Barwick of the Liberal Party of Australia 19 May 1960. The Marriage Act 1961 was eventually passed in a conscience vote on 22 March 1961, with an attempt by Victorian Senator George Hannan to insert a definition of marriage as "the voluntary union of one man and one woman for life to the exclusion of all others" rejected in a 40-8 vote. At the 1960 second reading speech Barwick noted that the legislation did not seek to define "marriage" while in 1961 the senator responsible for securing the law's passage in the Senate, John Gorton, suggested that:

Section 46 of the Marriage Act 1961 requires marriage celebrants to explain the legal nature of marriage in Australia to a couple as "the union of a man and a woman to the exclusion of all others, voluntarily entered into for life", in line with the 1866 English case of Hyde v Hyde. Before 2004 these words were descriptive or explanatory, rather than outlining what constitutes a legally valid marriage in Australia.

40th, 41st and 42nd Parliaments (2004–2010) In the later stages of the 40th Parliament, public attention increased with respect to same-sex marriage due to court decisions in Massachusetts and Canada legalising same-sex marriage. Two Australian same-sex couples married in Canada in 2004 and lodged an application in the Family Court of Australia in Victoria, seeking legal recognition of their Canadian marriages. Before their matter could be heard, the Howard government, prompted by a petition organised by Richard Egan of the Australian Christian Lobby, changed the law to prevent Australian recognition of same-sex marriages, rendering the cases pointless.

In an attempt to prevent any judicial imposition of same-sex unions in Australia, the Howard government introduced the Marriage Amendment Act in the Parliament on 27 May 2004. The amendment specified that marriage, undefined in the Act, would be defined as a "union of a man and a woman to the exclusion of all others" and that foreign same-sex marriages would not be recognised as such in Australia. Additional reforms to the Family Law Act prevented same-sex couples from being eligible adoptive parents for children in inter-country adoption arrangements, though these restrictions were eventually relaxed in 2014. The amendment passed the parliament on 13 August 2004 and went into effect on the day it received royal assent, 16 August 2004.

Following the Government's amendment to the Marriage Act banning same-sex marriage, the first attempts at reform came via private members bill's raised in the Senate by Michael Organ of the Greens and Natasha Stott Despoja and Andrew Bartlett of the Democrats. Organ introduced the Same Sex Relationships (Ensuring Equality) Bill 2004 and the Democrats the Same-Sex Marriage Bill 2006 in the following parliament. A further four bills were introduced in the Senate through the period of the Howard and Rudd governments, though all were either rejected or lapsed in parliament. Greens senator Sarah Hanson Young's 2009 bill to legalise same-sex marriage was the first bill of its kind reviewed by a parliamentary committee. In November 2009 the Legal and Constitutional Affairs Legislation Committee, despite recommending reforms designed to create a nationally consistent recognition scheme for same-sex relationships, recommended Ms Hanson-Young's Marriage Equality Amendment Bill 2009 not be passed. In the lead-up to the committee's decision, the largest protests for same-sex marriage in the nation's history took place on 1 August 2009, in a variety of cities across Australia. The bill did reach a vote in the Senate on 25 February 2010. The bill was rejected by a margin of 45 votes to 5, with only the Greens senators voting in favour of the bill and many Senators not in attendance.

43rd Parliament (2010–2013) In the election campaign of 2010, then-Prime Minister Julia Gillard, in an interview with the Australian Christian Lobby, stated that her government would not sponsor or support any bill to legislate for same-sex marriage if successful at the election. Despite narrowly retaining government, the Labor Party were quickly forced into an internal debate on the issue, with several party members publicly speaking out against the party and the leader's opposition to same-sex marriage. At the December 2011 National Conference, Labor overwhelmingly endorsed a change to the party platform, in support of legalising same-sex marriage. Prime Minister Gillard, who had stated her personal objection to same-sex marriage, sponsored a motion to allow MPs and Senators a free vote on same-sex marriage legislation. The motion passed by 208 votes to 184.

In February 2012, two bills to allow same-sex marriage in Australia were introduced in the 43rd Parliament. The Joint Parliamentary Inquiry into the Marriage Equality Amendment Bill 2012 and the Marriage Amendment Bill 2012 received 276,437 responses, the largest response ever received by a committee of the House of Representatives or Senate. 177,663 respondents were in favour of changing the law to recognise same-sex marriage, 98,164 were opposed to and 610 were unsure.

On 19 September 2012, the House of Representatives voted against passing its same-sex marriage bill by a margin of 98-42 votes. On 20 September 2012, the Senate also voted down its same-sex marriage legislation, by a vote of 41-26. In both instances, the Liberal/National Coalition honoured their 2010 election commitment to vote as a bloc against any same-sex marriage legislation.

+ Marriage Amendment Bill 2012Second Reading in House of Representatives Party Votes for Votes against (63) (44)– (19)– (6)– (1)– (1)– (1)– (1) – (4) Total 42 98

+ Marriage Amendment Bill (No. 2) 2012Second Reading in Senate Party Votes for Votes against (27) (21)– (4)– (3)– (1)– (9)– (1)– (1) – Total 26 41

In March 2013, former Labor prime minister Kevin Rudd announced his personal support of same-sex marriage. Upon returning to the prime ministership in June, Rudd promised to introduce same-sex marriage legislation within 100 days if Labor won the 2013 federal election, while granting its members a conscience vote.

44th Parliament (2013–2016) In September 2013, the Tony Abbott-led Liberal/National Coalition comfortably won government at the federal election. Though most Coalition MPs and senators (and Abbott himself) were opposed to same-sex marriage, Abbott stated at the time that the party may consider altering its position to be in favour of a free vote on the matter. By December 2013, deputy Labor Opposition Leader, Tanya Plibersek, announced that she would introduce a private member's bill in the Parliament, seeking the assistance and co-sponsorship of Coalition government minister Malcolm Turnbull and a free vote among all parliamentarians. In the same month, the High Court of Australia struck down a law which briefly legalised same-sex marriage in the Australian Capital Territory, on the basis that only the federal parliament, and not a state or territory parliament, had the legal authority to pass such a law.

In November 2014, Liberal Democratic Party senator David Leyonhjelm reintroduced the Freedom to Marry Bill 2014 in the Senate, though by March 2015 Leyonhjelm had deferred the imminent second reading of his bill due to the refusal of the Coalition party room to debate a free vote on the legislation.

In May 2015, renewed debate on the issue followed the 2015 Irish constitutional referendum that established same-sex marriage in Ireland, with several Coalition MPs publicly voicing their support for a free vote on same-sex marriage legislation and Labor MP Anthony Albanese stating that (contingent on a Liberal Party free vote occurring) "it is my judgment that there are now majorities in favour of marriage equality in both the House of Representatives and the Senate".

Capitalising on the renewed momentum, Labor leader Bill Shorten introduced the Marriage Amendment (Marriage Equality) Bill 2015 to the Parliament on 1 June 2015. Despite several Coalition MPs criticising Shorten for political opportunism, Prime Minister Tony Abbott promised a "very full, frank and candid and decent" debate inside the Liberal Party and also appeared to rule out a referendum on same-sex marriage. Further momentum for same-sex marriage occurred following the U.S. Supreme Court's ruling in Obergefell v. Hodges and in July 2015 details of a cross-party same-sex marriage bill to be introduced to the Parliament later in the year were revealed.