The universal shortcut to undo typing is Ctrl+Z on Windows and Command (⌘)+Z on Mac. Press it once to undo your last action; press it repeatedly to undo multiple steps in order.
Why Ctrl+Z Works Everywhere
The Undo command has been a core part of text editing since the 1980s, standardized by early graphical interfaces. Today, virtually every application—word processors, email clients, code editors, and even web browsers—maps Undo to the same keys. This consistency means you rarely need to look for an Undo button in a toolbar; the keyboard shortcut is almost always faster.
On Windows, Ctrl+Z is the default. On macOS, the equivalent is Command+Z (the ⌘ key, next to the spacebar). If you use a Windows keyboard with a Mac, the shortcut is usually the Windows key (⊞) + Z, depending on your keyboard settings.
How Undo Works: The Undo Stack
Undo doesn’t just revert the last character you typed—it reverts the last action. Each discrete change (typing a word, pasting text, deleting a paragraph) is stored in an “undo stack.” When you press Ctrl+Z, the most recent action is undone, and the stack moves backward. This is why pressing Ctrl+Z multiple times can undo a whole series of edits, one by one.
For example, if you type “Hello,” then bold it, then type “ world,” pressing Ctrl+Z once removes “ world,” a second press removes the bold formatting, and a third press removes “Hello.” The exact granularity varies by program—some group rapid typing into a single action, while others treat each keystroke separately.
Redo: The Reverse Shortcut
If you undo too much, the Redo shortcut reverses the undo. On Windows, it’s Ctrl+Y (or sometimes Ctrl+Shift+Z). On Mac, it’s Command+Shift+Z. Redo only works if you haven’t performed a new action after undoing—once you type or edit, the redo stack is cleared.
In Microsoft Word and Excel, Ctrl+Y is the standard redo shortcut. In Google Docs, Ctrl+Shift+Z works, but Ctrl+Y also works in most browsers. If one doesn’t work, try the other.
Undo in Specific Applications
While Ctrl+Z is universal, some applications add extra layers:
- Microsoft Word: Ctrl+Z undoes formatting changes, text edits, and even some layout actions. The Undo list (click the small arrow next to the Undo icon) lets you undo multiple steps at once.
- Excel: Ctrl+Z undoes data entry, cell formatting, and formula changes. However, Excel has a limit on undo history (usually 100 steps), and some actions (like running a macro) cannot be undone.
- Google Docs: Ctrl+Z works, and you can also use the “Version history” feature (File > Version history) to revert to an earlier saved state.
- Photoshop: Ctrl+Z works differently—by default, it undoes only the last step, but you can change it to use the History panel for multiple steps.
When Undo Doesn’t Work
Undo isn’t infallible. Common reasons it fails:
- File saved and closed: Once you close a document, the undo history is lost. Reopening the file doesn’t restore it.
- Action not undoable: Some operations, like saving a file, changing printer settings, or running a macro, cannot be undone.
- Undo history limit: Programs like Excel cap the number of undo steps. After that, older actions are forgotten.
- External changes: If another program or user modifies the file, undo may not work correctly.
If Ctrl+Z doesn’t work, check the Edit menu for an Undo option—if it’s grayed out, there’s nothing to undo. Also, ensure you’re not in a mode like “Overtype” (where typing replaces text) that might confuse the undo stack.
Undo on Mobile and Tablets
On smartphones and tablets, there’s no physical keyboard, so the shortcut varies:
- iOS (iPhone/iPad): Shake the device to get an “Undo Typing” popup, or use a three-finger swipe left to undo. With an external keyboard, Command+Z works.
- Android: The undo gesture depends on the app. In many apps, a three-finger tap or a popup with an Undo button appears after typing. With a physical keyboard, Ctrl+Z usually works.
In Google Docs mobile, you’ll find an Undo arrow in the toolbar at the top.
Customizing Undo Shortcuts
If Ctrl+Z doesn’t suit you, most applications let you change it:
- Microsoft Word: File > Options > Customize Ribbon > Keyboard Shortcuts (bottom of the dialog). Search for “EditUndo” and assign a new key.
- Google Docs: No built-in customization, but browser extensions can remap keys.
- VS Code: File > Preferences > Keyboard Shortcuts, search for “undo,” and change the binding.
For system-wide changes, tools like AutoHotkey (Windows) or BetterTouchTool (Mac) can remap any key combination.
Frequently Asked Questions
What if Ctrl+Z undoes the wrong thing?
Immediately press Ctrl+Y (or Command+Shift+Z on Mac) to redo it. If you’ve done other actions since, the redo might not be available. In that case, you may need to manually restore the content—check the app’s version history or autosave.
Why does Ctrl+Z sometimes undo more than one step?
Some applications group consecutive typing into a single undo step to make the history more manageable. For example, typing a full sentence might be one undo action in Word, not per character. This is intentional, but you can often adjust it in settings (e.g., in Word, the “Undo” option in Advanced settings).
Can I undo after saving a file?
Yes, as long as the file is still open. Saving doesn’t clear the undo history. However, once you close the file, the history is gone. If you need to revert to an earlier version, use the app’s version history feature (e.g., Google Docs) or a file recovery tool.
Is there an undo shortcut for the Windows command prompt?
In the classic Command Prompt, Ctrl+Z is used to send an EOF (end-of-file) signal, not undo. Instead, use the F7 key to view command history and select a previous command. In PowerShell, you can use Ctrl+Z to undo typing in the console, but it may not work in all contexts.
Does Ctrl+Z work in web browsers?
Yes, in text fields and contenteditable areas, Ctrl+Z undoes typing. It also undoes some browser actions like closing a tab (Ctrl+Shift+T reopens). However, it won’t undo a form submission or a page navigation.
Related
- Public Data Entry Registration: How It Works
- Forecast Planning Excel Template: How to Build One
- Run Command Shortcut Keys: Full List & How to Use
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Duplicate Filter in Google Sheets: Find Repeated RowsTo filter duplicates in Google Sheets, add a helper column with a COUNTIF formula, then filter that column…
- How to Change a Hanging Indent in Word for Any ParagraphTo change a hanging indent in Microsoft Word, select the paragraph or paragraphs, open the Paragraph settings from…
- How to Change Border Thickness in Excel for Clearer SheetsTo change border thickness in Excel for Microsoft 365 on Windows, select the cells, open Home > Borders…
- Excel Remove Text and Keep Numbers in a CellTo remove letters and symbols while keeping every digit in an Excel cell, enter =IF(A2="","",TEXTJOIN("",TRUE,IFERROR(MID(A2,SEQUENCE(LEN(A2)),1)*1,""))) in B2, assuming…
- Budget Tracker Spreadsheet Tips for a Clear Monthly PlanA useful budget tracker spreadsheet gives every transaction a date, category, and amount, then compares actual spending with…
- Center Across Selection in Excel: Add It to Quick AccessTo add Center Across Selection to Excel’s Quick Access Toolbar in Microsoft 365 for Windows, open File >…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.