The best way to unfreeze an air conditioner is to shut it off and allow the ice or frost on the air conditioner to melt.
You could use a hair dryer or heater to blow hot air on the air conditioner to help it defrost faster but allowing the air conditioner some time off can help the air conditioner unfreeze.
If it's a central air conditioner then you could turn the heat on and allow the heat to melt the frost off the AC coil inside which is what I've done before.
An AC or air conditioner whether a central air conditioner or window air conditioner, mini split air conditioner etc can all ice up due to a variety of different reasons.
Some reasons that an AC may ice up are due to lack of air flow, dirty coils, dirty air filter, overuse, an AC that is too small for the room it's cooling or the house it's cooling.
When an AC is too small then it has to run constantly or at least more often and longer to cool the room down which causes strain on the AC and then the AC can freeze up.
Make sure the AC coils are clean, and the fan is spinning on the central unit.
If it's a window air conditioner then you may need to pull the window AC out of the window and use some degreaser or other cleaning solution to clean the coils and the AC.
Then use a hose to wash it off.
If it's digital then you'll need to wait until the AC has dried out before you plug it back in for it to work.
Low refrigerant levels are a surprisingly common culprit when it comes to ice buildup on air-conditioning systems.
As the unit attempts to operate with less refrigerant than intended, the resulting drop in pressure can cause evaporator-coil temperatures to dip below freezing.