The short answer
Neither type is better in every case. A window unit is usually easier to buy, install and remove. A through-the-wall unit is a more permanent fixture, sealed into the building rather than sitting in a window. Cooling power matters, but the right choice usually depends on the room, the building and how long you plan to stay.
How each is installed
A window unit sits in an existing window opening. A support bracket and side panels hold it in place and fill the gaps around it. It usually needs no construction work.
A through-the-wall unit needs an opening cut in an exterior wall, a sleeve fitted into that opening, and the cabinet slid into the sleeve and secured. This involves framing, weather sealing and an electrical circuit suited to the unit, so many people hire a professional for it.
Cost
Window units generally cost less to buy and install. A through-the-wall unit adds the cost of the sleeve, carpentry, sealing and labor, and it can also raise the cost of the electrical work. Prices vary by region and model, so get several quotes rather than relying on a general figure.
Sealing and drafts
A well-installed through-the-wall unit can be better sealed than a window unit, because the sleeve and gaskets close the opening in the wall. A window unit depends on its side panels and the window’s own seal. Gaps there can let in warm air, insects and drafts. A poorly fitted unit of either type loses cooling, so check the seal either way.
Window use and light
A window unit blocks part of a window for the whole season. A through-the-wall unit leaves the window free, so you keep the view, the daylight and the window for ventilation. This matters most in rooms where that window is the main source of light.
Removal and security
A window unit can be lifted out and stored when the season ends. A through-the-wall unit stays in place, which some people prefer for security. The wall work is also permanent, so this type suits a home you plan to keep.
Maintenance and noise
Both types need similar upkeep. Clean or replace the filter, keep the outdoor coil clear, and check seals each season. Most room units have a filter behind the front panel, so check the manual for how your model’s filter is cleaned or replaced.
Both types also offer a dry setting for removing humidity. The difference between dry and cool settings is covered in air conditioner cool vs dry.
Noise varies more by model than by type, so compare published sound levels rather than assuming one style is quieter.
Efficiency
Compare efficiency ratings that come from the same test standard. The mounting style does not decide efficiency; the rating on the label does.
Which to choose
A window unit is often the better fit if you rent, want a simple setup, may move soon or have no suitable exterior wall. A through-the-wall unit tends to suit an owner who wants a sealed, permanent fixture and has a wall that works with a sleeve. Renters should get written permission from the landlord before any wall work.