The fastest way to rename a file
Right-click the file and select Rename from the menu that appears. Type the new name and press Enter. That is the standard method on Windows, Mac, and Linux — it works the same way on all three.
If you are using a keyboard instead of a mouse, select the file and press F2 on Windows or Linux, or Enter on Mac. The filename becomes editable in place. Type the new name and press Enter when you are done.
The file keeps its file extension — the letters after the dot, like .pdf or .jpg — unless you deliberately change it. Removing or changing the extension can make the file unreadable, so leave it alone unless you have a specific reason to alter it.
Key Takeaways
- Right-click any file and select Rename to change its name in place, then press Enter to confirm.
- Keyboard shortcut F2 (Windows and Linux) or Enter (Mac) opens the rename field without using a mouse.
- The file extension — the part after the dot — stays the same unless you deliberately change it.
- Renaming a file does not move it or change what program opens it, only what it is called in the folder.
- Batch renaming tools let you change multiple files at once if you need to rename dozens of files with a pattern.
Renaming files in bulk when you have many to change
If you need to rename ten or twenty files at once — say, photos from a camera or downloads with generic names — doing them one at a time wastes time. Batch renaming tools let you change multiple files using a pattern or a list.
On Windows, select all the files you want to rename, right-click the first one, and choose Rename. Type a new name and press Enter. Windows will automatically number them: if you type "Photo", the files become Photo (1), Photo (2), Photo (3), and so on. This works for any file type.
On Mac, select the files, right-click, and choose Rename Items. A dialog box opens where you can choose to replace text, add text before or after the current name, or use a custom format. For example, you can replace "IMG_" with "Vacation_" across all selected files at once.
On Linux, the method depends on your file manager. GNOME Files (the default on Ubuntu) does not have a built-in batch rename, but you can use a tool like Thunar (available in most Linux repositories) or open a terminal and use the rename command for more control. The terminal method is faster for large batches but requires learning the syntax.
When renaming breaks a file or program
Changing the file extension — the part after the dot — can make a file stop working. If you rename "document.pdf" to "document.txt", your computer may try to open it as a text file instead of a PDF, and it will show garbage characters instead of the document.
Some programs store the full filename (including extension) in their memory. If you rename a file that another program is currently using, that program may not find it and will show an error. Close the program first, rename the file, then open the program again.
On Windows, file extensions are sometimes hidden by default. If you see a file called "photo" but it is actually "photo.jpg", and you rename it to "photo_2024", you have accidentally changed it to "photo_2024.jpg" — the extension is still there, just invisible. To see extensions, open File Explorer, click View, and check the box for "File name extensions".
Renaming files with special characters or spaces
You can use spaces, numbers, and most punctuation in filenames. Hyphens, underscores, and periods are safe and commonly used. Avoid these characters: forward slash (/), backslash (\), colon (:), asterisk (*), question mark (?), quotation mark ("), less-than (<), greater-than (>), and pipe (|). Your operating system will reject them or they will cause problems when you try to share the file.
If you use a lot of spaces, consider using underscores or hyphens instead — "My_Document" or "My-Document" instead of "My Document". Spaces work fine, but underscores and hyphens are easier to read in a terminal window and less likely to cause problems if you ever need to move the file to a different system.
Finding a file after you rename it
Renaming a file does not move it. It stays in the same folder where it was before. If you cannot find it after renaming, look in the folder where you renamed it, not somewhere else.
If you renamed a file and now a program cannot find it, the program was looking for the old name. You have two choices: rename the file back to its original name, or tell the program where the file is now. Most programs have an "Open" dialog where you can browse to the file's new location and name.
On Windows, use the search box in File Explorer (the magnifying glass icon) to search for part of the new filename. On Mac, use Spotlight (Command + Space) and type the filename. On Linux, use the file manager's search function or open a terminal and use the find command.
Renaming system files and why you should not
Your operating system uses certain files to run. Renaming or deleting them will break your computer. These files are usually hidden from view — you will not see them in your normal file browser unless you turn on "show hidden files".
If you are organizing your own documents, photos, and downloads, you will never encounter these files. If you are working in a folder and see files that start with a dot (like ".config" on Mac or Linux) or files with names like "System32" on Windows, leave them alone. Renaming them requires administrator permission for a reason — the system needs them to work.
Frequently Asked Questions
Can I undo a rename if I made a mistake?
Yes. Press Ctrl+Z (Windows and Linux) or Command+Z (Mac) when ready after renaming to undo it. If you have already closed the folder or done other work, the undo may not work. In that case, you will need to rename the file back manually.
What happens if two files have the same name in the same folder?
Your operating system will not allow it. If you try to rename a file to a name that already exists in that folder, you will get an error message. You must choose a different name or delete the existing file first.
Can I rename a file while it is open in a program?
On Mac and Linux, yes — the program will keep using the file even after you rename it. On Windows, it depends on the program. Some programs lock the file while it is open, and you will get an error if you try to rename it. Close the program first to be safe.
Does renaming a file change its creation date?
No. The creation date stays the same. The "modified date" updates to show when you renamed it, but the original creation date is preserved. You can see both dates in the file's properties or details view.
What is the longest filename I can use?
On Windows, Mac, and Linux, the limit is usually 255 characters including the extension. In practice, keep filenames shorter — under 50 characters is a good rule. Long filenames can cause problems when you share files or use them in certain programs.