How can I make Notepad to save text in UTF-8 without the BOM?

Use Notepad++ instead. See my personal blog post on it. From within Notepad++, choose the "Encoding" menu, then "Encode in UTF-8 without BOM".


  1. Use Notepad++ - it is free and much better than Notepad. It will help to save text without a BOM using EncodingEncode in UTF-8 without BOM:

    Notepad++ v6 and olders: Screenshot of the Notepad++ Menubar -> Encoding -> Encode in UTF-8 without BOM menu in Notepad++ v6.7.9.2

    Notepad++ v7+:
    Screenshot of the Notepad++ Menubar -> Encoding -> Encode in UTF-8 without BOM menu in Notepad++ v7+

  2. When I encountered this problem in Java, I didn't find any library to parse these first three bytes (BOM). So my advice:

    • Use PushbackInputStream(in, 3).
    • Read the first three bytes
    • If it's not BOM (EF BB BF), push them back
    • Process the stream as UTF-8

I just learned from this Stack Overflow post, as @martin-geisler points out, that you can save files without the BOM in Windows Notepad, by selecting ANSI as the encoding.

I'm assuming that for more advanced uses this won't work because the resulting file is probably not the end encoding wished, but actually ANSI; but I tested and confirmed this works to save a very small .php script without BOM using only Notepad.

I learned the long, hard way that Windows' Notepad is not a true editor, although I'd like to point out for others that, despite this, it is misleadingly called up when you type "editor" on newer Windows machines, at least on one of mine.

I am currently using Emacs and other editors to solve this problem.