How to Write Code in Windows Notepad

Windows Notepad is a very basic text editor that comes pre-installed on all Windows Operating Systems.

Notepad may be quite simple with no syntax highlighting or Intellisines like other tools like Notepad++, but that does not stop you from writing any kind of programming or scripting code in Notepad.

Let's take a look at how to write and run "Hello World" code in Notepad for 5 popular programming languages.

Note: For all the below examples you will need respective language software installed to compile and execute the programs using CMD/Terminal.


    <!DOCTYPE html>
        document.write("Hello, World!");

    Make sure to save the file with .html extension.

    Save Code in Notepad as hello.html

    You can open this HTML file in a web browser (such as Microsoft Edge or Google Chrome) to see the output.

    Hello World example Notepad


    print("Hello, World!")

    Save the above Python code with a ".py" extension (e.g.,

    To run this code, open Command Prompt or Terminal on your Windows PC, navigate to the folder where the file is located, and then run:



    public class HelloWorld {
        public static void main(String... args) {
            System.out.println("Hello, World!");

    To run it, open Command Prompt, navigate to the folder containing, and compile and run it using these commands:


    java HelloWorld


    #include <iostream>
    int main() {
        std::cout << "Hello, World!" << std::endl;
        return 0;

    Make sure to save the file as hello.cpp


    puts "Hello, World!"

    Make sure to save the file as hello.rb, to run it, open Command Prompt and run:

    ruby hello.rb

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap