How to Remove the .txt File Extension in Windows 11 (4 Easy Ways)

January 04, 2026 by Andrew Smith

If you’ve ever created a text file in Windows 11 and wished you could get rid of the .txt file extension—or better yet, prevent it from showing up entirely—you’re not alone. Whether you’re tidying up filenames for aesthetic reasons, scripting, or repurposing text files into a different format, knowing how to remove or hide the .txt extension can be quite helpful.

TL;DR

In Windows 11, removing the .txt file extension is simple once you can see and edit file extensions. You can rename the file manually, use the Command Prompt, or run a PowerShell command. You can also change the default “Save As” behavior in Notepad to avoid adding .txt in the first place. Just remember that removing extensions can make files harder to open unless you know what you’re doing.

Why Remove the .txt Extension?

Text files are incredibly common, but they aren’t always intended to stay as text. You might be renaming a file so that it works in a new context—like turning script.txt into script.py for Python code, or you may not want an extension at all for stylistic or utility reasons.

Windows 11 tries to help users by hiding extensions, but when you want to control them, you need to know how to reveal and manipulate these filename components confidently.

1. Enable File Name Extensions in File Explorer

Before you even try to remove a .txt extension, make sure Windows 11 is set up to show file extensions. Here’s how you can enable that feature:

  1. Open File Explorer.
  2. Click on the View tab in the ribbon.
  3. Hover over Show and make sure File name extensions is checked.

Once enabled, every file will display its extension (e.g., example.txt instead of just example).

Important Note: Be cautious when changing file extensions—Windows uses them to know which program to use for opening a file, so changing or removing them can make files temporarily unreadable unless purposely handled.

2. Rename the File to Remove the .txt Extension

This is the most direct and visual way of removing an extension. Here’s how:

  1. Right-click the .txt file and select Rename.
  2. Delete the .txt part of the filename.
  3. Press Enter.
  4. When Windows asks for confirmation with a warning message, click Yes.

And that’s it! Your file now no longer has a visible extension, and Windows might treat it as an unknown file type. This is fine if you’re renaming it for specific use cases or plan to assign it a different extension later.

3. Use the Command Prompt

If you prefer working in the terminal, or if you need to batch-rename several files, the Command Prompt is your friend.

Here’s how to do this:

  1. Open Command Prompt. You can do this by typing cmd in the Windows Search and clicking Run as administrator.
  2. Navigate to the directory where your file is located using the cd command. For example:
    cd C:\Users\YourName\Documents
  3. Type this command to rename the file:
    ren "myfile.txt" "myfile"

This immediately drops the .txt extension, leaving just the base filename. You can even automate larger sets using wildcards or scripting logic.

4. Use PowerShell for Renaming Flexibility

PowerShell gives you even more flexibility compared to Command Prompt. With PowerShell, you can perform bulk renaming across directories quickly and with precision.

Here’s how to remove a .txt extension with PowerShell:

  1. Open PowerShell (right-click Start and select Windows Terminal (Admin)).
  2. Enter the following command:
    Rename-Item "C:\Users\YourName\Documents\myfile.txt" "myfile"

If you want to remove .txt from multiple files in a folder, try this:

Get-ChildItem -Path "C:\Your\Folder\Path" -Filter *.txt | 
ForEach-Object {
  Rename-Item $_.FullName ($_.BaseName)
}

This script targets all .txt files and strips their extensions in one go. It’s efficient and clean, but be careful—there’s no Undo button!

Bonus: Avoid Creating .txt Files in the First Place

Sometimes, the solution is prevention. If you’re using Notepad and you don’t want your file to get the .txt extension when you save it, here’s the trick:

  1. When saving the file, enclose the filename in quotes, like this: "myfile".
  2. Select All Files (*.*) from the “Save as type” dropdown.
  3. Click Save.

This prevents Notepad from appending .txt to your file and instead creates the file exactly as you named it. Likewise, you can use quotes to assign a different extension, like "config.ini".

Things to Keep in Mind

  • Hidden extensions: If extensions still aren’t showing even after enabling them, make sure you’re not dealing with a shortcut or link.
  • Opening files: Once you remove .txt, Windows may no longer recognize what app should open the file. You can right-click and choose “Open with” to manually select a program.
  • File types matter: If you’re renaming files programmatically or scripting, missing extensions can confuse systems if there’s no context as to what the file is.

When Should You Not Remove the .txt Extension?

In many cases, it’s perfectly okay to remove the .txt extension. But there are times when you should reconsider:

  • You need the file to open easily in text editors—removing the extension may require extra steps each time.
  • You’re working in environments where file type is detected by extension (e.g., email attachments, FTP uploads).
  • You’re sharing the file with others who may not understand how to open an “extension-less” file.

If organization and clarity are your goal, you might consider renaming with a new, more appropriate extension rather than removing it entirely.

Final Thoughts

Removing the .txt extension in Windows 11 isn’t just for tech pros or command-line junkies. Whether you’re a beginner looking to clean up your desktop or a developer organizing scripts, these four easy methods—manual rename, Command Prompt, PowerShell, and saving without the extension—can make it easier to work with your files just the way you want.

While it’s easy to remove extensions, always keep in mind: Windows uses them to manage how files open and behave. If you remove the extension, be sure of your reason and always know how to get it back if needed. A little caution goes a long way!