As a long time Windows users I'm used to switch between two windows using keyboard. Now at Mac I just can't figure out how to do that!

Command-Tab works nicely between apps, but how to do the same within one application having several windows open? Especially when using XCode? For example within Firefox you can do control-tab and control-shift-tab to navigate between tabs. Doesn't work with XCode, not between two different open projects.

Doing 4-fingers-down, looking at screen, finding the previous window and clicking on it with mouse takes waaaay too long time. It interrupts whatever I was doing, distracts from whatever I was thinking about and starts annoying me - enough to write this desperate call for help in StackOverflow :)

There's got to be a secret handsha... keyboard combination!

  • 1
    The answers as given, Command-` are correct for most, if not all, keyboard layouts. (You can also use that to go backwards in the application switcher, after you hit Command-Tab.) I wonder if layouts that have no ` have a different shortcut like, for what I've heard, the Apple-French layout -- store.apple.com/ca/product/MB110C/A
    – Arjan
    Commented Nov 19, 2009 at 9:37

8 Answers 8


Before this is moved to superuser, the shortcut you're looking for is command-`

  • 14
    I don't think so, looking for smthng else. In my system that key combination does cycle inside one app windows, but goes only FORWARD. I want especially switch between current and previous window(s). Right now I have 6 open wins in XCode, so that's 5 keys AND knowing how many wins I have open AND counting the presses. If I got to actually look at and select windon, my concentration disappears. Yes, easy to distract!
    – user18604
    Commented Nov 19, 2009 at 10:21
  • 2
    Try command-shift-`. Commented Feb 19, 2010 at 19:34

Command-Tab works nicely between apps, but how to do the same within one application having several windows open?

I was also a bit annoyed at this, until I found the "Move focus to the next window in application" keyboard shortcut option (under System Preferences -> Keyboard -> Keyboard Shortcuts -> Keyboard & Text Input).

I set it to Cmd-§ (⌘§) myself (which is close to Cmd-Tab and I couldn't think of anything better). Shift-Cmd-§ cycles in the opposite direction. It's not ideal, but sort of tolerable for me, although I'd still prefer Cmd-Tab toggling between all windows.

There are also 3rd party utilities that improve OS X's window switching capabilities; check out Witch for instance. I haven't tried these myself though.


When you have to window active (focused), do Command-~.

  • Is there any keyboard layout that has the tilde on the lower part of the key? (Like one does not need Shift to type a tilde?)
    – Arjan
    Commented Nov 19, 2009 at 9:39
  • Usually default keyboard shortcuts are designed for US layout, you could check that. Might mean you have to type blind or buy extra keyboard with US layout.
    – user18604
    Commented Nov 19, 2009 at 10:24
  • 3
    By Command-~, he means Command-Shift-` I think.
    – MJeffryes
    Commented Nov 19, 2009 at 13:35
  • Heh, with this keyboard shift-` is impossible :) It's Command-Shift-´to make Command-`, if that is more clear. Also Command-~ is actually Command-Alt-¨. Guess I'll have to live without (some) shortcuts and just get on with the remaining ones. Thanx anyway!
    – user18604
    Commented Nov 20, 2009 at 11:25
  • Sorry, looks like this system uses (removed) character for text formatting! I was trying to type what Ziggamorph shows above. The latter one.
    – user18604
    Commented Nov 20, 2009 at 11:28

Hyperswitch (free) and Witch ($14, though more configurable) allow doing this.

  • Awesome, that's exactly what I needed and also what the author needed! Commented May 2, 2021 at 13:48

If you want to make a custom shortcut, I noticed that macOS Sierra seems to automatically map Shift-[shortcut here] to the reverse of your original shortcut, when it makes sense (e.g. anything that involves "next" probably has a corresponding "previous" version). Possibly because someone expected that a user would expect this to happen?

So if you look in System Preferences > Keyboard > Shortcuts > Keyboard you'll only find "Move focus to next window" bound by default to Command-` and this is why Command-Shift-` triggers "Move focus to last window."

Set "Move focus to next window" to any other combination that doesn't involve Shift, and Shift-[that combination] will do "Move focus to last window".


I found this decision tree for finding the right shortcut:

Decision tree for last window shortcut on mac

Decision tree for last window shortcut on mac

The main decisions are:

  • Was it in a different Program from the one you want to switch from?
  • Is the other Window on the same Desk?
  • Do you use a "QWERTY" Keyboard layout?
  • Is this the previous window you used?

It shows that it's not easy. The source (xpt.de) choose to use a third party app called Hyperswitch.

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 29, 2022 at 9:55
  • Great decision tree! Commented Aug 15, 2022 at 21:09
  • The decision tree is inaccurate. If the previous window from a different app (first answer is yes, then done) has another window in the current desktop, CMD+Tab will switch to that window instead. Commented Oct 14, 2022 at 20:25
  • Dang @GeorgeLeung - I think you're right. We should use this tree as a base and expand it, so it's also covering that case ;-)
    – Patrick
    Commented Feb 9, 2023 at 10:18
  • I think there's even more complication when a second monitor is involved. Commented Feb 10, 2023 at 4:27

To switch to the previous / next window of the same tab (macOS):

  • Cmd ⌘ `

  • Cmd ⌘ Shift ⇧ `

The order depends on the keyboard layout (UK / US).

Based on the answers from: Shortcut for toggling between different windows of same app?:


try "cmd" + "<" within xcode. It works with my keyboard - KK

You must log in to answer this question.