Turn off the power. Shut off the switches for your furnace and air-conditioning from your electrical service panel.
Remove the cover from the old thermostat. Depending on the model, you may need to remove some mounting screws, or it might just click off its base. Remove the mounting screws from the base and pull it away from the wall. Be careful not to disconnect any of the wires.
Mark the wires. There will be three or more colored wires attached to the old thermostat. Apply a small piece of masking tape to each one and write which terminal it's attached to. Don't worry if the color of the wire doesn't match the letter of the terminal; there's no universal standard. Your red wire may attach to the R terminal, but a white wire may go to a Y terminal. Just label each wire with its corresponding terminal. Loosen the screws to disconnect the wires.
Remove the cover from your new thermostat and attach its base unit to the wall. Depending on the model and your wall, you may need to drill pilot holes for the mounting screws.
Attach the wires to the correct terminals. Using your labels as a guide, attach the Y wire to the Y terminal, the G wire to the G terminal, and so on. Test each connection with a gentle wiggle to be sure it's secure.
Attach the thermostat cover to the base unit. If it uses backup batteries, install the batteries as directed.
Turn on the power and test your thermostat. If it's programmable, follow the manufacturer's instructions to set the time, date and temperatures.