The Ctrl+Z keyboard shortcut is the universal Undo command in Windows, reversing your most recent action in almost any program. Press it once to undo the last change, and press it repeatedly to step backward through a history of changes. On a Mac, the equivalent shortcut is Command+Z.
Where Did Ctrl+Z Come From?
Ctrl+Z dates back to the early days of personal computing, specifically to IBM and Microsoft’s text-based interfaces in the 1980s. In those systems, the Control key combined with a letter performed a function, and Z was chosen because it sits at the end of the alphabet—a natural mnemonic for “go back to the end” or “undo the last thing.” The convention was cemented when Microsoft adopted it for Word and Windows, and it has remained virtually unchanged for over four decades. The Mac’s Command+Z followed the same logic when Apple standardized its own shortcuts.
How Undo Works in Different Apps
Undo is not a single global system; each application maintains its own “undo stack,” a list of your recent actions in that app. When you press Ctrl+Z, the app pops the most recent item off that stack and reverses it. This means:
- In a word processor (Word, Google Docs, Notepad): Undo removes the last typed word, deleted paragraph, or formatting change.
- In a spreadsheet (Excel, Sheets): Undo reverts the last cell edit, formula change, or formatting action—but not a file save.
- In an image editor (Photoshop, Paint): Undo reverts the last brush stroke, filter, or selection change.
- In a file manager (Windows Explorer, Finder): Undo restores a file you just deleted or renames it back to its previous name.
Each app has its own limit on how many steps it remembers. Microsoft Office typically allows up to 100 undo levels, while Photoshop defaults to 50. Once you exceed that limit, the oldest actions are discarded permanently.
Ctrl+Z vs. Ctrl+Y and Redo
The counterpart to Undo is Redo, which reverses an Undo. If you undo too far, Redo brings the action back. The standard shortcuts are:
- Ctrl+Y on Windows (and often Ctrl+Shift+Z as an alternative)
- Command+Shift+Z on Mac
Redo only works immediately after an Undo, before you perform any new action. If you type a new character after undoing, the redo history is cleared—the app assumes you’ve moved on. This is a common point of confusion: people press Ctrl+Y expecting to redo something from an hour ago, but it only works for the most recent undo sequence.
Ctrl+Z in Excel: Special Behavior
In Microsoft Excel, Ctrl+Z works slightly differently than in other Office apps. Excel’s undo stack includes structural changes like inserting or deleting rows, columns, and sheets, but it does not include certain actions:
- Running a VBA macro (macros cannot be undone with Ctrl+Z—you must save a backup copy before running one).
- Deleting a sheet (this is irreversible without a saved backup).
- Changing a cell’s formatting via a macro or external link.
Excel also has a quirk: if you use Ctrl+Z after a Paste Special operation, it undoes the entire paste, not just the special part. For most users, the practical takeaway is to save your workbook frequently, because Ctrl+Z will not protect you from every mistake.
How to Undo on Mac and Mobile
On macOS, the shortcut is Command+Z for Undo and Command+Shift+Z for Redo. On iPhones and iPads, there is no physical Ctrl key, but you can:
- Shake the device (if enabled in Settings > Accessibility > Touch > Shake to Undo).
- Tap the three-dot menu in many apps and select “Undo.”
- Use a connected hardware keyboard with Command+Z.
On Android, most apps show an Undo button in the toolbar (often a curved arrow) or in the overflow menu. Some apps, like Gmail, show a temporary “Undo” toast after you delete an email—that is a separate feature, not the Ctrl+Z shortcut.
Common Problems and Misconceptions
One frequent misconception is that Ctrl+Z can undo a file deletion from the Recycle Bin. It cannot—once you empty the Recycle Bin, Ctrl+Z will not bring the file back. You would need file recovery software or a backup. Another myth is that Ctrl+Z works across different programs. If you copy text from a browser and paste it into Word, pressing Ctrl+Z in Word only undoes the paste, not the copy in the browser. Each app’s undo history is isolated.
A practical problem: if you press Ctrl+Z too many times and lose work you wanted to keep, immediately press Ctrl+Y (or Command+Shift+Z) to redo forward. If you accidentally close a document without saving, Ctrl+Z will not help—but many apps now have autosave or “recover unsaved documents” features (e.g., Word’s File > Info > Manage Document).
Alternatives to Ctrl+Z
If you need to undo something that Ctrl+Z cannot handle, consider these alternatives:
- Version history in Google Docs, Office 365, and many cloud apps lets you revert to an earlier saved version, even minutes ago.
- File history / Time Machine on Windows and Mac can restore older versions of files.
- Recycle Bin / Trash holds deleted files until you empty it—check there before panicking.
- App-specific undo menus (Edit > Undo) work the same as the shortcut but are discoverable if you forget the keys.
For Excel specifically, you can use File > Info > Version History if you have AutoSave enabled, or File > Options > Save to set a shorter autosave interval.
Frequently Asked Questions
Does Ctrl+Z work in every program? No—some apps, especially games and custom software, may not implement Undo or may use a different shortcut. In most standard productivity apps, it works as expected.
How many times can I press Ctrl+Z? It depends on the app. Office apps allow up to 100 undo steps; Photoshop defaults to 50; Notepad allows only one. You can change the limit in some apps (e.g., Photoshop’s Preferences > Performance > History States).
Why did my Ctrl+Z stop working? This usually means you’ve reached the undo limit, or the last action was not undoable (like a macro or a file save). Try closing and reopening the file, or check if the app has a separate undo history setting.
Is there a way to undo a save? No, Ctrl+Z cannot undo a file save. You must rely on autosave or version history. In Excel, if you save over a file, you can sometimes recover a previous version via File > Info > Version History.
What is the difference between Ctrl+Z and Ctrl+Shift+Z? Ctrl+Shift+Z is an alternate Redo shortcut on Windows (used in many apps like Chrome and Adobe), while Ctrl+Y is the more traditional Redo. On Mac, Command+Shift+Z is the standard Redo.
Related
- Basic Data Entry: What It Is and How It Works
- Select Line Shortcut: Quick Keys for Excel & Word
- Free Online Data Entry Software for PC
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Find and Replace in Microsoft Word: Commands and ShortcutsIn Microsoft Word for Windows, press Ctrl+H to open Find and Replace; enter the text to search for,…
- Employee Schedule Template for Google Sheets: SetupAn employee schedule template in Google Sheets is a reusable spreadsheet for assigning shifts, tracking hours, and sharing…
- Google Sheets: How to Sort by Last NameYes. Google Sheets can alphabetize a list by last name, but it does not automatically identify surnames inside…
- How to Begin Track Changes in Microsoft Word for ReviewsTo begin tracking edits in Word for Microsoft 365 on Windows, open your document, select Review > Track…
- SUMIF Checkbox in Google Sheets: Sum Checked RowsIf your checkboxes are in A2:A20 and the values to add are in B2:B20, use =SUMIF(A2:A20,TRUE,B2:B20) to total…
- ISNUMBER in Excel: How It Works and When to Use ItIn Excel, use =ISNUMBER(A2) to check whether the value in cell A2 is a number; the result is…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.