Maintaining a healthy dog takes a lot of trips to the vet to administrate all the vaccines dogs need, and in one of those trips, you should install a microchip on them.
In that microchip, they will carry all the information needed to contact you if they ever get lost. This way, if the people who find them take them to the vet, they will be able to get your name and contact information.
Your dog won't even feel the microchip, and the implantation is pretty painless as well. The microchip cost for dogs is usually around , which is close to nothing if you think that it is going to last for their whole lives.