This post explains how to change the default character encoding in Notepad (e.g., UTF-8 to ANSI) on Windows 10.
ANSI has been the default encoding in Notepad in earlier versions of Windows 10. Since Windows 10 version 1903, the default Notepad encoding is UTF-8.
When you launch notepad.exe
, the default encoding is shown in Notepad’s status bar in Windows 10 v1903 and higher.
When saving a file in Notepad in any version of Windows 10, you can choose one of these character encoding types:
- ANSI
- UTF-16 LE
- UTF-16 LE
- UTF-8 (default)
- UTF-8 with BOM
UTF-8 is preferred if you want to use non-ASCII characters like Č, Ć, Š, ä, ö, ü, ß
or symbols like → in your text file. Some of these accented characters will be lost if you save the file as ANSI. Notepad also warns you when you do so:
This file contains characters in Unicode format which will be lost if you save this file as an ANSI encoded text file. To keep the Unicode information, click Cancel below and then select one of the Unicode options from the Encoding drop down list. Continue?
Some users need ANSI to be the default
There are users who want to change Notepad’s default encoding from UTF-8 to ANSI. For example, VBS/WSH script coders may want ANSI as the default – because CScript.exe or WScript.exe can’t run UTF-8 encoded .vbs files.
Let’s see how to change Notepad’s default encoding to ANSI or another encoding in Windows 10.
Change the Default Character Encoding in Notepad
To set the default encoding in Notepad, you can use the Registry Editor.
- Right-click Start, click Run. Type
regedit.exe
and click OK. - Go to the following registry branch:
HKEY_CURRENT_USER\Software\Microsoft\Notepad
- From the Edit menu, click New → DWORD (32-bit) value
- Name the value as
iDefaultEncoding
- Double-click
iDefaultEncoding
and set its data to1
(for ANSI).
Here is the list of possible value data you can assign: 1 = ANSI 2 = UTF-16 LE 3 = UTF-16 BE 4 = UTF-8 BOM 5 = UTF-8
- Exit the Registry Editor.
- Open a new instance of Notepad. You’ll see that the default encoding has changed to
ANSI
— which is reflected in the status bar.
Note that the above registry setting applies only when you open a new Notepad instance by running Notepad.exe. If you open a text document previously saved in a different encoding, Notepad will open the file in the encoding specified in that file.
Despite the above registry modification, when you use the Desktop New menu (New → Text document), the New Text Document.txt fill will use UTF-8
anyway.
There is no workaround for that in Windows 10.
Force UTF-8 as default for New Text Documents (older versions of Windows)
This is the opposite of the earlier method – changing the New Text Document’s default encoding to UTF-8 from ANSI. This method is for older (than v1903) versions of Windows 10 and earlier Windows OS.
Clicking on Desktop → New → Text Document uses ANSI in earlier versions of Windows. However, using the template file method, we can force Windows to create the New Text Document in UTF-8. Follow these steps:
- Open Notepad as administrator.
- From the File menu, click Save.
- Choose
UTF-8
encoding from the dropdown list. - Save the file as
template.txt
inC:\Windows\ShellNew
. - Close Notepad.
- Launch the Registry Editor (
regedit.exe
) - Go to the following branch:
HKEY_CLASSES_ROOT\.txt\ShellNew
- Create a new String (REG_SZ) value named
FileName
- Double-click
FileName
and set its data to:template.txt
- Exit the Registry Editor.
We’ve now created an UTF8-encoded template file and referenced it in the registry. Windows will use it when you create a new text document.
- Right-click desktop → click New → Text Document.
- Double-click the newly created document.
If the above steps were executed correctly, you should see UTF-8 in the Notepad status bar.
[Note that the reverse (UTF-8 to ANSI) is not possible using the template method, as Notepad will open an ANSI-encoded file in UTF-8 mode anyway. You may look for Notepad alternatives in that case.]
One small request: If you liked this post, please share this?
One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!
Hello,
Very interessting article.
On a Windows 7, when I open a Ini Files (in UTF-8) with notepad, as soon as I do a modification, once saved, the file is a UTF-8-BOM .
Do you know why ?
Thanks you
Thanks for the tip
The German characters ü, ö, ä, ß etc. are NOT UTF-8. This is a mistake in your article.
Ramesh,
Thank you for this article. It was quite helpful while I’m preparing a migration to Linux (after 35+ years of DOS, OS/2 and Windows) and want to make sure that the thousands of plain text files I currently have will not be compromised (and still readable) during and after the migration. I’m not a native English speaking and writing person, you see, so I’m quite sure some of them WILL get hurt if I handle them with too little knowledge.
@m: It’s a matter of definition. The four characters you mention (and I happen to use quite frequently in my text files) can be encoded in extended, single-byte ASCII (~ ANSI) but still are, of course, also part of UTF-8. The other three characters in the example can not be encoded as single-byte (unless some obscure and very old fashioned tricks with page code selections from the DOS era were used, perhaps). So, if you try to save the exact example with NotePad you WILL get the message shown. Hence in my opion the example is not faulty and the word ‘mistake’ is perhaps a bit inappropriate. But I got your message nonetheless.
Gigli,
Because of my migration preparation I have been experimenting with NotePad and TextPad (and some text editors under Linux). I found that there is in my ancient version of Notepad-under-Windows-10 (Update 1511) no option to save UTF-8 files without a BOM. I also learned that the BOM is not standard in UTF-8 (because it has no added value, unlike in UTF-16 and UTF-32) but that Microsoft has for some reason decided ages ago to add a pseudo BOM to every UTF-8 encoded text file. The only use I can think of is that of a fingerprint.
Anyway, if you can not suppress it in early versions of Windows 10, it is most likely that it also is added ‘by design’ under Windows 7.
TextPad (not a Microsoft product), on the other hand, has no support for a BOM for UTF-8 and always stores UTF-8 encoded text without it. A nice premium of TextPad (in my case) is that it has options to store UTF-8 in Windows (with CRLF) or Unix (with LF only) format. And it has many highlighting and indenting options for programmers also found in NotePad++, but then without the pricetag.