Members at the party conference in Bournemouth today voted overwhelmingly to support a motion to revoke Article 50 - the formal process to leave the EU - if it gains a majority in a general election.
The motion says a Liberal Democrat majority government would be "recognised as an unequivocal mandate to revoke Article 50 and for the UK to stay in the EU".
The party said that "first and foremost" it still wants a referendum in which it would campaign to stop Brexit.
But if, as is much more likely, a general election is called first, it will stand on a "cancel Brexit" platform.
After the vote, the party said in a statement: "The European Court of Justice ruled that the UK has the power to unilaterally revoke Article 50 and withdraw us from the Brexit process.
"And the further we get into understanding what Brexit will mean for the UK, the clearer it is that we need to stop Brexit.
"The last few months with Boris Johnson as Prime Minister have been like living in a dystopian nightmare.
Jo Swinson: I'll cancel Brexit if I'm PM
"The Tory government's own research has shown that a no-deal Brexit would cause immeasurable damage to our NHS, jobs, the environment, and would put people's lives at risk.
"EU citizens were told that they could lose their right to healthcare, to rent property, or to have a job in the UK after October 31.
"And this Conservative government has chosen to shut down democracy rather than accept any scrutiny of their decisions."
The statement went on: "The Liberal Democrats demand better than Brexit, and we have a plan to stop it.
"First and foremost, the Liberal Democrats are calling for a people's vote to stop Brexit.
"But if a general election comes first, we will take on the tired old parties with an unambiguous stop Brexit message.
- Read more
"And we do so with the full-throated support of our members."
It comes after former Tory MP Sam Gyimah defected to the party.
Mr Gyimah lost the Conservative whip when he backed a move by opposition parties to prevent a no-deal Brexit last week.