MacBook Power Adapters exist in seven different wattages - 29W USB-C, 30W USB-C, 45W, 60W, 61W, 85W, and 87W. There are a few straightforward rules to determine which wattage your computer requires.
The 12-inch MacBook (first introduced in March 2015) originally used a 29W USB-C adapter until Apple released the 30W USB-C adapter in 2018. As of this writing, these adapters can only be used with the 12-inch MacBook.
The MacBook Pro 13 inch released in 2016 (and later) use a 61W USB-C adapter while the MacBook Pro 15 inch released in 2016 (and later) use a 87W USB-C adapter.
The MacBook Air uses a 45W MagSafe Power Adapter. Since 2012 it has used the MagSafe 2 style adapter. Prior to that the MacBook Air used the "L" style connector.
The MacBook (pre-2011 version), every MacBook Pro 13 inch, and the 2.53 GHz MacBook Pro 15 inch (mid 2009) use the 60W MagSafe Power Adapter. MacBooks from late 2009 to mid 2012 used the "L" style connector while earlier models had the "T" style connector.
Other than the one MacBook Pro 15 inch model listed above, every other MacBook Pro 15 inch BEFORE 2016 and every MacBook Pro 17 inch uses the 85W MagSafe Power Adapter. The switch to the "L" style connector started in mid 2010 to 2012 but before that the "T" style connector was used.
You can charge using a higher wattage than is permitted, but you should not use a lower wattage.
For instance, the MacBook Pro 13 inch uses a 60W MagSafe, but you can use an 85W MagSafe to charge or power it (although it will not charge any faster). You should not use a 45W with the MacBook Pro 13 since that is lower than its 60W requirement.
USB-C power adapters cannot be used with Macs that require a MagSafe or MagSafe 2 adapters and vice-versa.
If you are in the market for a new power adapter, beware of non-Apple / third-party power adapters. These power adapters vary in quality and may or may not work well with your MacBook.
When possible buy an official MagSafe or USB-C adapter manufactured by Apple as this will always be the safest option.