Why is Alt+F4 the hotkey for closing a window? Why not Alt+F5 or Alt+F3?

In a One Dev Question video, I discussed why Alt+F4 is the hotkey for closing a window. That explains why it's a function key rather than an alphabet key, but why F4 specifically? Why not F5 or F3?

It's F4 because that was the next key available.

The hotkeys according to CUA were as follows:

  • Alt+F10: Maximize
  • Alt+F9: Minimize
  • Alt+F8: Resize
  • Alt+F7: Move
  • Alt+F6: Switch windows within an app
  • Alt+F5: Restore
  • Alt+F4: Close

Most of these hotkeys died out over time due to disuse. The ones that remain active today are Alt+F6 and Alt+F4.

Wait, what about F11 and F12? Why were they skipped over?

The original IBM PC keyboard didn't have F11 or F12 function keys. The function keys went up to F10.

Comments (32)
  1. Mantas says:

    Quite a lot of those are still available in the large X11 graphical environments, such as GNOME. (Never used them even once though.)

    But why do they go down from Alt+F10 and not up from Alt+F1?

    (The link to “the original keyboard” says: “This website […] should be back online in November 2017, or earlier.” I had no idea the post queue here was *that* long.)

  2. The MAZZTer says:

    Where is ALT+F6 in use? Doesn’t seem to work in any Windows app I’ve tried.


    “The functions keys go to twelve. Look, right across the keyboard, F10, F11, F12.” “Oh, I see. And most keyboards go up to F10?” “Exactly.” “Does that mean it’s better? Is it any better?” “Well, it’s two better, isn’t it? It’s not F10. You see, most blokes, you know, will be using up to F10. You’re using F10 here, all the way on the right, all the way on the right, all the way on the right, you’re on F10 on your keyboard. Where can you go from there? Where?” “I don’t know.” “Nowhere. Exactly. What we do is, if we need that extra push over the cliff, you know what we do?” “Put it up to F12.” “F12. Exactly. Two better.” “Why don’t you just make better use of F1-F10?” “[pause] These go to F12.”

    1. skSdnW says:

      Don’t know why the Alt was dropped but Explorer and IE switches between “UI areas” with F6.

      1. F6 is generally used in Microsoft Windows applications to set keyboard focus to various key UI parts, such as the ribbon, the address bar (if present), the main document, the sidebar (if present), the list view header (if present), the status bar etc. It works in most web browsers, Windows Explorer, Microsoft Office, and most other well-behaved Windows desktop apps. (I make sure all my apps use F6 for this as well.)

    2. Ctrl+F6 switches between document windows in an MDI app. I can’t recall using Alt+F6 before.

    3. Calvin says:

      ALT+F6 works in Word but not in Excel or any other Office apps.

    4. Timothy Byrd says:

      @The MAZZTer – I so wish I could upvote your comment!

    5. Antonio Rodríguez says:

      Alt+F6 switches between top-level windows belonging to the same process. That means that it requires an SDI application where the same process opens several documents, each one in its own top-level window. But nowadays that is quite rare: almost all SDI applications spawn one process per document, and Alt+F6 doesn’t work on them.

      This can be tested on modern versions of Office: opening two Excel spreadsheets creates two excel.exe processes, while opening two Word documents create a single winword.exe process. That’s why Alt+F6 works in Word but not in Excel.

    6. DaveL says:

      Alt+F6 used to switch between modeless dialogs and the main application (Notepad’s Find dialog was a good example case). It went missing at some point (possibly after Windows XP), perhaps Raymond can tell us why?

  3. Jason says:

    Well, we know the backlog still goes back quite a way: the link to the IBM keyboard is down, with an expected return of November 2017.

    1. Torsten Kammer says:

      The backlog length is an undocumented implementation detail. Do not rely on it, to avoid creating yet another backwards compatibility issue.

      1. R P (MSFT) says:

        *backlog compatibility

      2. Ray Koopa says:

        !Do not use this link to retrieve backlog details. Use the CBPostQuestion or CBAskRaymond function instead

        1. Ben Voigt says:

          CBPostQuestion is an experimental API that may not work in future releases of Windows (it depends on Transactional NTFS). For maximum compatibility, call OldNewPostQuestion instead ;)

  4. Brian_EE says:

    Wikimedia to the rescue: [img]https://en.wikipedia.org/wiki/Model_F_keyboard#/media/File:IBM_Model_F_AT.png[/img]

    1. J Cobb says:

      Would appear they also didn’t have a less-than (<) key. :P

  5. Chris Long says:

    These shortcuts made way more sense back in the *really* old days when PC keyboards had ten function keys arranged in two columns of five at the left edge of the keyboard. I remember having the cardboard template for WordPerfect 5.1 that was designed to fit over the function keys to label them.

    With that keyboard, you could reasonably hit any combination of Shift / Ctrl / Alt and any function key with just your left hand. F9 and F10 were the bottom row so they were the closest to the Shift / Ctrl / Alt modifiers, so it would make sense for them to be assigned the most common operations, like Minimize and Maximize. Were those keyboards (Model F) still in use when Windows 1.0 came out?

    I still remember the day I was given a new and “improved” PC keyboard and wondering how on earth anyone was supposed to make use of the function keys right at the top.

  6. Deanna says:

    ohhh, that probably explains alt+F10 as “full screen” too.

  7. HiTechHiTouch says:

    Some more keyboard history…

    The IBM mainframe (3270 terminal) had a keyboard with 12 function keys on the right, similar to a telephone keypad. It also had 4 cursor movement keys in a square, the top two were left and right, the lower up and down.

    This was quite popular. They collected millions of keystrokes from human tester subjects while designing the layout, and left room for an “Alt” key in later editions. For 20 years, the 3270 keyboard was a standard. Only later would the DEC V-52/57/100 evolution of the teletype keyboard approach the volume of 3277/8 keyboards.

    Many mainframe software applications assigned the lower left function keys to do page scrolling al la the cursor keys. F7,F8 left & right; F10,F11 up & down. F1 always seemed to be “Help” when available. F3 (upper right) or F12 (lower right) was most often End or Exit.

    Now enter the PC hardware developers who redesigned their keyboard totally ignoring the all the human factors research done at Los Gatos. The cursor keys were in the T format. 10 Function keys appeared on the left, not the right, and they were done 2×5 because there were 5 rows of typewriter keys/space bar.

    General opinion was that this layout sucked. Nobody liked it, neither mainframers nor accounts wishing for a 10-key adding machine. (IBM keypunches overlaid a 10 key using IFRC I, O and P as 1, 2, and 3.)

    Plus the 3720 had an Enter key at the right of the space bar row, not to be confused with a New Line key where Enter is on the PC keyboard. The PC lacked this key, which was important, because the 3270 was a “block Mode” terminal, meaning that a whole screen could be filled out “offline” and then sent with the 3270 Enter key (about where left-Ctrl is today) to the mainframe for processing. Again, 3270 emulator programs had to cope with missing keys on the PC keyboard, i.e. F11, F12, Enter, PA1, PA2.

    Enter the AT, which was supposed to be a redesign to make everyone happy. Again, the PC people controlled the layout, changes motivated only by complaints. The T format cursor keys stayed. 12 Function keys were present so mainframe apps could be “emulated” (as in a 3720 terminal emulator program), but where to put them?

    Across the top was the only room left after the accountants got their 10 key on the right. Everybody hated it, if nothing more than the functions keys did not line up with the number row 1 through 10, dash, equals keys. People always claimed to be pressing functions keys when they wanted the number row keys, and the reverse.

    And while F12 & F12 arrived, the keyword was still missing keys needed for 3270 emulation, e.g. Enter.

    The gazillion PC apps all mapped the keys as they wanted. F1 was often Help and F10 was End or Exit or like a modern “click on OK”.
    Into this chaos came the CUI-GUI guideline, which begat menu bars with File on the left and HELP on the right, and End/Exit/Close always the last item on the File menu.

    CUI also assigned some standard functions to the function keys. This was basically ignored by applications, and used only by window managers like Windows 3.1. So Microsoft windows people were working against the ad hoc developer function key assignments, and everyone wanted to click instead of press, so the battle wasn’t too important in the grand scheme of things. The rule that a PC should be driveable without a mouse sometimes was forgotten, and the Alt+Fx keys were important only to IT people trying to drive blind in an emergency or special needs users/programs.

    However, this was all going on at the time of the great IBM-Microsoft divorce (allegedly over where on the screen (0,0) was to be located) but actually about development and design process. There were two giant software beasts in the room and the tails kept colliding. And the power shifted from IBM to Microsoft, marked by the return of PC DOS V6 to Microsoft.

    Another complication was the attempt by IBM to create a keyboard for their PC/Terminal Emulator thingy called a PC3270, and the mainframe datacom people needed a keyboard for their 327x replacement terminals that was “familiar” to PC users. They finally got their Enter key back (keeping New Line), and the IBM world now had 3 (4 if you count the original 10 Function Key board) similar but dis-similar keyboards running around IBM shops the last couple of decades of the twentieth century.

    Those who do not know history… Those who never do a literature search… Those under pressure to deliver SOMETHING quickly… Those who refuse to look at other cultures…

    1. HiTechHiTouch says:

      Quick correction: The 3270 Enter key was on the right of the space bar, not the left. Right hand, little finger was the natural motion.

    2. Drak says:

      Those who innovate, those who want to try to improve…

    3. RP says:

      Are you sure about the original PC keyboard having the cursor keys in T formation because this is the case neither in my memory nor in https://en.wikipedia.org/wiki/IBM_PC_keyboard ?

    4. John Elliott says:

      The sequence of keyboards was:
      * XT keyboard – 10 function keys at the left.
      * 3270PC keyboard – 24 function keys at the top named PF1-PF24, and 10 function keys at the left with 3270-specific functions.
      * AT keyboard – a cut-down version of the 3270PC keyboard with only the 10 function keys at the left, this time labelled F1-F10.
      * PS/2 keyboard – 12 function keys at the top.

      This history is why the scancodes for function keys are different in set 2 and set 3. The function key scancodes in set 2 are the scancodes returned by the 3270PC keyboard for the function keys on the left, and the ones in set 3 are the ones returned by the function keys on the top.

    5. Brian says:

      Re: “The rule that a PC should be driveable without a mouse sometimes was forgotten”

      In the late nineties, I was the lead on a graphical engineering application (think of something between a complex Visio template and a tool for laying out multi-layer circuit boards). One of the absolute rules in the spec sad that the app “should be driveable without a mouse”. I kept pushing back saying “no one will ever use this using only a keyboard – it makes no sense”. But, the specs guys won.

      So we put someone to work. You could tab between major elements (boxes on the screen) using some key combination. Once you were on a “box” on the screen, there was a way to tab between connections. Once a connection was selected, you could tab between the handles on each connection’s corner or line segment. Then you could use the arrow keys to move the handles. We got a prototype ready to show. We showed it to the product owners and they looked at it and said “whoa, that’s awfully complicated and will cost a fortune to document, and no one will ever use it – why did you put it in, tear it out”.

      That’s how that rule got forgotten by our team.

    6. Antonio Rodríguez says:

      Nowadays everyone has mouse and/or touch screen, and it has been that way since the early 90s. But being able to navigate a GUI with keyboard is still useful for those times where the pointing device doesn’t work. You don’t need to make every feature available, but being able to gracefully save and close an open document is a must. Just take into account that it’s an emergency mode and use common sense in what needs to be done with the keyboard.

      Productivity and data entry applications can also be a lot faster to use with just the keyboard if properly designed. A clean and consistent design, following IBM CUA, helps a lot.

      Sadly, that lore is getting forgotten in the era of mobile and web applications.

      1. James says:

        Being able to navigate with just a keyboard is also important for accessibility. Not everyone can use a pointing device.

  8. Richard Wells says:

    With 3270 shortcuts, Alt-F1 was for help in a field on the screen; Alt-F2 toggled word wrap; Alt-F3 changed format. CUA tried to include all the established IBM shortcuts.

  9. xp.client says:

    Some of these could still be useful (Resize and Move) because some evil apps disable the window menu (Alt+Space) e.g. Opera.

  10. Jonathan says:

    I didn’t know about Alt+F7. Too bad that one went away, it’d occasionally be useful for corralling wayward applications that left themselves stranded somewhere beyond the viewable area after a resolution change, undocking, or disconnecting of an additional monitor. (Alt, Space, M can work, but only if the window has that shortcut menu)

    1. Well, if the window doesn’t have a System menu with an enabled “Move” command, Alt+F7 wouldn’t do anything. It’s just a shortcut, not a backdoor.

  11. Eric-Jan says:

    At the start of W10 we lost Shift-Del to cut text. I made complaint after complaint via the MS feedback. And see it’s back. I’ll give you my bankaccount if you want to reward me. ;-)

  12. MarcK4096 says:

    I still miss having the F keys on the left side of the keyboard.

Comments are closed.

Skip to main content