Dog owners will be required by law to have their pets microchipped from next year.
Rural Affairs Secretary Richard Lochhead confirmed compulsory microchipping would come into force in April 2016 – the same time as the measure is introduced in England and Wales.
Mr Lochhead said the move would be a “huge help” in reducing the number of lost or abandoned dogs in Scotland.
It is thought about two-thirds of dogs have already had a microchip containing their owners’ details fitted voluntarily.
A public consultation last year on responsible dog ownership revealed more than 83% favoured making the system compulsory.
Mr Lochhead announced the introduction of compulsory microchipping during a visit to the Dogs Trust in Glasgow.
The charity, which has already fitted chips in more than 10,000 dogs, is offering the service for free at its rehoming centres and at mobile clinics throughout the country.
The Rural Affairs Secretary said: “Scotland is a nation of animal lovers and so we must do all we can to safeguard dog welfare and promote responsible ownership.
“The owners of out of control dogs can be required to microchip their dogs under existing legislation, and I understand that around two-thirds of the dogs in Scotland have already been microchipped on a voluntary basis.
“In 2014, over 10,000 dogs across these islands were reunited with their owners as a result of a microchip. This is an impressive figure, but it could be improved on dramatically by ensuring that all dogs are microchipped, and, equally important, that their details are kept up-to-date.
“I can now confirm that compulsory microchipping will be introduced in Scotland next year, after it was overwhelmingly backed in our public consultation. This will be a huge help in reducing the number of lost and abandoned dogs in Scotland.”
Mr Lochhead added: “I very much welcome the generous free microchipping offer made by Dogs Trust ahead of the new legislation coming into effect. I would encourage all dog owners to ensure that their dogs are microchipped and that their details are up to date.”
Dogs Trust campaigns director Elvira Meucci said: “Dogs Trust greatly welcomes the introduction of compulsory microchipping for all dogs in Scotland from April 2016.
“We have long been a leading voice in the campaign for compulsory microchipping and are delighted to see the Scottish Government legislate for this important component of dog welfare and responsible ownership.
“As the UK’s largest dog welfare charity, reducing the nation’s stray dog population is at the very heart of Dogs Trust’s ethos, which is why we have committed to ensuring no dog owners will lack the financial ability to microchip their dog.
“Dog owners can get their dog chipped for free by appointment at our two Scottish rehoming centres in Glasgow and West Calder, or at one of our many drop-in events across the country which will run until the legislation comes into force.
“Of course, we also always stress at these events that a microchip on its own is not enough, and owners must ensure that they keep their details up-to-date.”