The House of Commons is due to vote on the UK Prime Minister Boris Johnson's freshly-inked deal with Brussels tomorrow.

The vote could come down to the tightest of margins, particularly with the DUP saying it will vote against the agreement.

A total of 639 votes will be in play when the deal is debated, which means the Government will need at least 320 votes to be certain of a majority.

If every Tory MP who is able to vote also backs the deal, this gives the Government 285 votes - well short of the number required.

So what will Mr Johnson have to do if a deal is voted down in Westminster?

Parliament debate and vote

Tomorrow, parliament in London - both the House of Commons and the House of Lords - will hold a special sitting to vote on the deal.

Mr Johnson's Conservative Party does not have a majority in the Commons. His opponents are trying to force both a delay to the UK's departure from the EU and another referendum.

Other options include collapsing his government so that others can take control of the Brexit process.

If the deal is approved, Mr Johnson can proceed with his plan to depart the EU on 31 October.

If rejected though, he may seek approval to leave the EU without an agreement on that date.

The Democratic Unionist Party, which supports the British government in parliament, has said that it cannot support the deal.

The opposition Labour Party, the Scottish National Party and the Liberal Democrats have all said they will oppose it.

If Mr Johnson loses votes on both a deal and no-deal, he is required by law to write a letter to the EU requesting more negotiating time, delaying Brexit until 31 January 2020.

The British government has said that it will both comply with this law and that the UK will leave the EU on 31 October.

What are the numbers?

Mr Johnson needs at least 320 votes to be certain of victory in the 650-seat parliament.

This number is less than 326 because seven Sinn Féin members do not sit, and the speaker and three deputies do not vote.

Conservatives - Mr Johnson's party does not have a majority in parliament and is not united on Brexit.

There are 288 Conservative seats and most would be expected to vote with the prime minister.

But a faction of committed Brexiteers could rebel if they feel the deal does not provide a satisfactory break from the EU. The group, which can number as many as 80, but has a hardcore of around 28, is unlikely to vote as a single bloc and is difficult to predict.

DUP - The party says its ten MPs will vote against the agreement.

Conservative exiles - Mr Johnson expelled 21 Conservatives from his party last month because they did not support his plan to leave the EU on 31 October, with or without a deal.

Another, former cabinet minister Amber Rudd, quit the party over Brexit and also sits as an independent.

Some could support the deal, others are more likely to reject it and back a delay to hold a second referendum.

Labour Party - Labour leader Jeremy Corbyn has said his party cannot support the agreement.

Labour rebels - Labour rebels are crucial to Mr Johnson's hopes of getting a deal approved.

A small handful of Labour MPs are explicitly pro-Brexit and have supported previous attempts to back a deal.

Another larger group of around 20 Labour rebels, who want the UK to leave the EU with a deal, could also back Mr Johnson, depending on the final terms.

Other parties - Most remaining politicians are expected to vote against a deal.

They are made up of 35 Scottish National Party members, 19 Liberal Democrats and 45 from smaller parties or independents.

The SNP and Liberal Democrats said they opposed the deal. Some independents are likely to vote for it.

Previous votes

Parliament has already rejected an earlier Brexit deal, negotiated by Mr Johnson's predecessor Theresa May, three times.

Brexit

If MPs reject the deal, then under the so-called Benn Act the prime minister is obliged to request an extension of Article 50, delaying Brexit.

Mr Johnson has said he will not ask for an extension, while UK government ministers have said the government will obey the law.

The EU also does not have to grant an extension, though it is understood it is unlikely to refuse it rather than have a no-deal scenario.

It is likely Mr Johnson will face a legal challenge if he refuses to write the letter.

By not requesting an extension then it would mean a no-deal Brexit on 31 October, the date of the default position of the UK leaving the EU.

Deal or no deal, a UK general election is generally expected before the end of the year.