I find Win-left arrow and Win-right arrow really useful in Windows 7 to make a window take up 50% of the left or right side of the screen, respectively. However, is there any command that will make a window take up 50% of the screen and be centered? Even if it doesn't adjust the size of the window, is there a keyboard shortcut to make a window center itself vertically and horizontally? Thanks.
6 Answers
This is not exactly for centering, but lets you move the window left and right (and up and down) easily.
- Focus a window.
- Press Alt+Space.
- Press M (for “Move”).
- Use the arrow keys to move the window exactly where you want it.
- Press Enter when done.
- 301
-
1This solution requires no additional software to be installed. It might not be the exact solution, but I think it is enough to get the job done – afuzzyllama Jun 30 '17 at 02:43
-
This only works if a window is not maximized. – TylerH Feb 27 '18 at 21:05
-
@TylerH: that is true. However, it only requires you to press windows + right (to place window in 50% right position), and then follow the instructions in this answer to move it the left. – Rasmus Larsen Sep 28 '18 at 07:44
The Windows+arrow keys are quite useful here.
(Windows)+← (Left)
and
+→ (Right)
cycle through going to the left or right 50% of the screen,
and restoring the window to its original size and position.
+↑ (Up) maximizes the window.
+↓ (Down)
restores the window if it is maximized, and minimizes it otherwise.
- 3,447
-
2That didn't seem to do it for me. It looks like it minimizes my window, or restores it if the window is maximized. – Sarah Vessels Jun 24 '10 at 20:00
-
2On my machine, dual monitor, I can click Win-Left and it will go to left 50% on that screen. If I continue clicking on Win-Left it will go to right 50% on the other screen, next will center and finally left on the other screen. Win-Right does the opposite – wbeard52 Jun 24 '10 at 20:21
-
1Win-Down is plain wrong. It either restores a window from maximized or minimizes it (if it's restored already). It won't do anything center-y with the window. – Joey Jun 24 '10 at 22:37
-
Have you tried it? It works on my machine. I can't speak of the other machines. – wbeard52 Jun 24 '10 at 23:15
-
3@wbeard52: I just tried Win-Left repeatedly and it cycled through 50% on left side of screen, 50% on right side of screen, and how my window originally was (not centered, small). – Sarah Vessels Jul 02 '10 at 13:22
-
2Repeatedly pressing Win-Left or Win-Right simply cycles through placing the window on the left/right 50% of the available monitors, then puts it back where it was before. It does not center the window in any way. – dgw May 14 '15 at 06:18
2023-02-24: The Microsoft PowerToys “Fancy Zones” feature can more or less fit this use case now: https://learn.microsoft.com/en-us/windows/powertoys/fancyzones
But I'm not completely happy with it yet, and since AutoHotkey has recently reached v2.0, here's a ported version of the script:
#Requires AutoHotkey v2.0
; Win + Alt + ArrowUp
#!Up:: CenterActiveWindow()
CenterActiveWindow()
{
; Get the window handle from de active window.
winHandle := WinExist("A")
; Prevent errors if there is no active window.
if (!winHandle) {
return
}
; Create a memory buffer to store DllCall return.
; https://www.autohotkey.com/docs/v2/lib/Buffer.htm
monitorInfo := Buffer(40 + (32 << !!1))
; https://www.autohotkey.com/docs/v2/lib/NumPut.htm
NumPut("UInt", monitorInfo.Size, monitorInfo, 0)
; Get the current monitor from the active window handle.
; https://www.autohotkey.com/docs/v2/lib/DllCall.htm
monitorHandle := DllCall("MonitorFromWindow", "UInt", winHandle, "UInt", 0x2)
DllCall("GetMonitorInfo", "Ptr", monitorHandle, "Ptr", monitorInfo.Ptr, "Int")
; Get WorkArea bounding coordinates of the current monitor.
; https://www.autohotkey.com/docs/v2/lib/NumGet.htm
WALeft := NumGet(monitorInfo, 20, "Int")
WATop := NumGet(monitorInfo, 24, "Int")
WARight := NumGet(monitorInfo, 28, "Int")
WABottom := NumGet(monitorInfo, 32, "Int")
; Calculate window coordinates.
; Change the factor to fit your desired width.
winW := (WARight - WALeft) * 0.5
winH := WABottom
winX := WALeft + (winW / 2)
winY := WATop
WinMove(winX, winY, winW, winH, "A")
}
Previous answer:
I would suggest using AutoHotkey.
An example script that does exactly what you asked was already provided in an answer to another question.
Here's the code of the script:
#Requires AutoHotkey v1.1.33.02
#!Up::CenterActiveWindow() ; if win+alt+↑ is pressed
CenterActiveWindow()
{
; Get the window handle from de active window.
winHandle := WinExist("A")
VarSetCapacity(monitorInfo, 40)
NumPut(40, monitorInfo)
; Get the current monitor from the active window handle.
monitorHandle := DllCall("MonitorFromWindow", "uint", winHandle, "uint", 0x2)
DllCall("GetMonitorInfo", "uint", monitorHandle, "uint", &monitorInfo)
; Get WorkArea bounding coordinates of the current monitor.
A_Left := NumGet(monitorInfo, 20, "Int")
A_Top := NumGet(monitorInfo, 24, "Int")
A_Right := NumGet(monitorInfo, 28, "Int")
A_Bottom := NumGet(monitorInfo, 32, "Int")
; Calculate window coordinates.
; Change the factor to fit your desired width.
winW := (A_Right - A_Left) * 0.5
winH := A_Bottom
winX := A_Left + (winW / 2)
winY := A_Top
WinMove, A,, winX, winY, winW, winH
}
I made a slight adjustment so the bottom of the window doesn't go beneath the taskbar, and changed the windowWidth from 0.7 to 0.5.
Now working with multiple monitors, and uses the work area for top and bottom values.
On a side note, WinSplit Revolution has been discontinued and replaced by a paid app called MaxTo.
In addition to being very powerful and covering much more use cases, AutoHotkey is also free and open source.
- 231
-
1Almost great... Except for the one serious issue. With multiple extended monitors, this always moves a window from a secondary monitor to the main one. Any ideas on how to fix this? WinMove does not seem to have any extra parameters. – Dima Korobskiy Aug 27 '19 at 03:46
-
@DKroot I'll have to try with a second screen. I've only been using this on a single ultrawide. Here's what the doc says on WinMove: «Negative values are allowed for the x and y coordinates to support multi-monitor systems and to allow a window to be moved entirely off screen.» There are examples of multi-monitor scripts on the forum, but it gets more complicated: https://autohotkey.com/board/topic/63931-another-multi-monitor-window-mover/ – vctls Aug 27 '19 at 19:52
-
Thanks so much for the link! I was able to combine your script and the linked script into one working perfectly. (The linked script does not resize hence not working e.g. on maximized windows). The script is too long to be included in the comments. Do you mind me posting it as a separate answer? – Dima Korobskiy Aug 28 '19 at 20:25
-
Another testing note on your script: interestingly, in a setup with 3 monitors, e.g. #1 main, #2 and #3 it works fine on #1 and #3, but moves windows from #2 to #1. – Dima Korobskiy Aug 28 '19 at 20:28
-
1Huh, that's weird. I updated it to make it work on multiple monitors. I tried to keep it as short and on topic as possible, but you might want to go for the Deluxe Edition like the ones in the forum ;) – vctls Aug 29 '19 at 11:53
-
thanks for this script. i was looking for something similar to op and was able to tweak this to fit my needs. question: where is the tweak you made to ensure the active window is not pushed below the taskbar? – lushness-deplete-gallantly May 25 '20 at 16:40
-
@brnnnrsmssn I'm simply using the work area instead of the screen height. WorkArea already excludes the taskbar. Check the post history if you're curious. – vctls May 25 '20 at 19:37
You should check out WinSplit Revolution; it has what you need and is customizable.

- 18,809
- 57,463
-
Looks like with 3 clicks of the middle button in WinSplit's window causes my focused window to stretch and fill the whole height of the monitor, which is fine, and be centered horizontally. :) – Sarah Vessels Jul 02 '10 at 13:26
Try Sizer by Brian apps. It's free and completely customisable. http://www.brianapps.net/sizer.html
- 21
I took @vctls solution and made it so the windows+up key would perform this function and maximise/restore the window. If the window is maximised it will restore it to the middle of the screen. If the window is restored it will maximise it. A second press will centre it active. Basically I combined this case and this one. It means you get all the functionality if windows+up with the added bonus of centre Autohotkey script to toggle minimize/restore?
It also fixes the fact that changing the width ( Change the factor here to your desired width) centres the window still
#Up::CenterActiveWindow() ; if win+↑ is pressed
CenterActiveWindow()
{
; Get the window handle from de active window.
winHandle := WinExist("A")
WinGet MX, MinMax, A
If MX {
WinRestore A
}
Else {
WinMaximize A
return
}
VarSetCapacity(monitorInfo, 40)
NumPut(40, monitorInfo)
; Get the current monitor from the active window handle.
monitorHandle := DllCall("MonitorFromWindow", "uint", winHandle, "uint", 0x2)
DllCall("GetMonitorInfo", "uint", monitorHandle, "uint", &monitorInfo)
; Get WorkArea bounding coordinates of the current monitor.
A_Left := NumGet(monitorInfo, 20, "Int")
A_Top := NumGet(monitorInfo, 24, "Int")
A_Right := NumGet(monitorInfo, 28, "Int")
A_Bottom := NumGet(monitorInfo, 32, "Int")
; Calculate window coordinates.
winW := (A_Right - A_Left) * 0.6 ; Change the factor here to your desired width.
winH := A_Bottom
winX := ((A_Right - A_Left) - winW) /2
winY := A_Top
WinMove, A,, winX, winY, winW, winH
}
- 101