---
title: "How to Read a G-code File in Notepad++"
description: "Open the .nc file in Notepad++, turn on line numbers and a monospace font, then add a User Defined Language so G, M, and coordinate words get color."
url: https://gcodepractice.com/journal/how-to-read-a-g-code-file-in-notepad/
canonical: https://gcodepractice.com/journal/how-to-read-a-g-code-file-in-notepad/
author: "Lawrence Arya"
authorUrl: https://www.linkedin.com/in/vibecoding/
published: 2026-06-08
updated: 2026-06-08
category: "Guides"
tags: ["notepad++", "g-code", "reading code", "editor"]
lang: en
---

# How to Read a G-code File in Notepad++

> **TL;DR** Open the .nc, .tap, or .txt file in Notepad++, switch on line numbers and a monospace font, and add a User Defined Language so G, M, T, S, F, and coordinate words are color coded. Then read the program in blocks. Notepad++ only makes the code legible, it does not run, simulate, or verify it, so you still confirm the program on the machine.

Notepad++ is one of the most common ways beginners open a G-code file, and it works well for reading because it is fast, free, and shows raw text exactly as the control will see it. The catch is that out of the box it treats your program as plain text, so everything is the same color and a long file is a wall of characters. A few small settings turn it into a readable, color coded program you can scan in blocks.

It helps to be clear about what you are doing and what you are not. Notepad++ lets you open, read, search, and lightly edit a program. It does not run the program, simulate the toolpath, or check whether a move is safe. Keeping that boundary in mind is what makes it a useful tool rather than a false sense of security.

## Open the file the right way

CNC programs use extensions like .nc, .tap, .cnc, .ngc, or sometimes just .txt. Notepad++ opens all of them as text. If Windows hides extensions, you can end up with a file saved as program.nc.txt without realizing it, which then confuses the control, so turn on file extension display and check the real name. This single setting prevents one of the most frustrating problems, where a machine refuses a file that looks fine because its real name has a hidden second extension.

Once the file is open, three settings make it readable immediately. Turn on line numbers from the View menu, because operators and setups refer to program lines by number, and an alarm often points to a specific line. Pick a monospace font so columns line up; a clean monospace font genuinely [improves how fast you read code](/journal/best-fonts-for-reading-g-code/). Leave word wrap off so each block stays on its own line, since wrapping makes a single block look like several and hides the program's real structure.

## Add syntax highlighting so the words pop

The single biggest upgrade is color. Notepad++ has no built-in G-code language, but it supports a User Defined Language, or UDL, that you configure once to color the word types. The [Notepad++ user manual explains the UDL system](https://npp-user-manual.org/docs/user-defined-language-system/), and several ready made G-code UDL files exist that you import so G words, M words, and coordinates each get their own color.

Setting up a UDL is a one-time job. You open the User Defined Language dialog, create a new language, and assign keyword groups: one group for G-codes, one for M-codes, one for the axis and parameter letters, and a comment style for text in parentheses or after a semicolon. Once it is saved, every G-code file you open is colored automatically. If you would rather not build it by hand, importing a community UDL file does the same thing in a few clicks, and you can tweak the colors to your taste afterward.

With a UDL active, your eye learns to jump to the parts that matter: motion commands, spindle and coolant codes, and the coordinates. [G-code](https://en.wikipedia.org/wiki/G-code) is modal, so a single G01 governs many lines below it, and color makes that structure obvious instead of buried.

## What to scan for, by color

Once highlighting is on, read the program by word type rather than left to right. This is the same way you would [follow how a control reads a program](/journal/how-does-a-cnc-machine-read-code-step-by-step/), block by block.

| Word | Example | What to scan it for |
| --- | --- | --- |
| N | N100 | Line or block number for reference |
| G | G00, G01, G54 | Motion type, plane, and work offset |
| M | M03, M06, M08, M30 | Spindle, tool change, coolant, program end |
| T | T2 | Which tool the next section uses |
| S and F | S8000, F300 | Spindle speed and feedrate values |
| X Y Z | X12.5 Y-4.0 Z2.0 | The actual coordinates and depths |
| Comment | (FACE) or ;note | Operator notes, ignored by the control |

A general reference such as the [LinuxCNC G-code list](https://linuxcnc.org/docs/html/gcode/g-code.html) is handy beside the editor for looking up any word you do not recognize.

## A short worked read

Suppose you open a file and the first colored lines read like this in plain English. The header shows G90 and G21, so absolute coordinates in millimeters. A G54 selects work offset 1. A T3 M06 changes to tool 3, then S6000 M03 starts the spindle, and G43 H3 applies the tool length offset. A G00 rapid moves above the start, then M08 turns on coolant, and a G01 with a Z value and an F feed begins cutting. Reading those eight colored lines tells you the units, the offset, the tool, the speed, and that a safe approach happened before the cut. That is a complete verification of the program header, done in under a minute once the colors guide your eye. The same read works at the end of the file: scan the last colored block for a clean retract and an M30, and you have confirmed the program both starts and finishes the way it should. Building that two-end habit, read the head and read the tail, catches a surprising share of posting problems before they ever reach the spindle.

## Use search to navigate a long program

A real strength of Notepad++ for G-code is fast searching, which turns a long file into something you can move around in quickly. Use Find to jump to the next tool change by searching for M06, or to every retract by searching for G28. The Find All in Current Document feature lists every match in a panel, so searching M06 instantly shows you how many tools the program uses and where each one starts. Searching for G54 through G59 confirms which work offsets the program touches. This is how an experienced reader checks a 3,000 line file in a minute: they do not scroll, they search for the codes that matter and read the blocks around them.

Search is also how you sanity-check a worry. If you suspect a program never turns coolant off, search for M09 and see whether it appears. If you want to confirm the program ends properly, search for M30. Treating the codes as search anchors is one of the fastest reading habits you can build.

## Column edit and macros for repetitive changes

Two more Notepad++ features help when you need to make the same small change many times, though they call for care because the editor does not understand G-code meaning. Column mode, held with Alt while you drag, lets you select a vertical block, which is handy for reading aligned coordinates. The macro recorder can replay a keystroke sequence across many lines. These are powerful for tidying or annotating a file, but remember the editor is blind to modal state, so never use a bulk edit to change motion or structure without re-reading the result. Use these features to read and annotate, and keep actual program changes small and deliberate.

## When Notepad++ is the wrong tool

Notepad++ is excellent for reading and small edits, but it is not a verifier. For checking whether a program is actually safe, you want a backplotter or simulator that draws the toolpath, and ultimately the machine itself with a careful first run. The table below sums up when each tool fits.

| Tool | Good for | Not for |
| --- | --- | --- |
| Notepad++ | Reading, searching, small text edits | Simulating or proving safety |
| A backplotter or simulator | Visualizing the toolpath | Catching real fixture or stickout issues |
| The machine, single block | Final proof on real metal | Skipping the read and sim first |

Treat the editor as the first step, not the last. A clean looking file in Notepad++ is not a verified file.

## Editing pitfalls to avoid

If you do edit in Notepad++, a few traps cause real damage. Because G-code is modal, deleting or reordering a line can change the meaning of every line after it, so change values rather than structure. Watch decimals carefully, since some controls read a missing decimal point very differently, turning X10 into a much larger or smaller move than X10. intended. Do not let the editor add a stray extension when you save, and keep a backup of the original before you change anything. The safest habit is to make the smallest possible change, then read the surrounding block again to confirm it still makes sense. If you want a fuller treatment of safe editing, see the guide on [editing posted G-code by hand](/journal/how-to-manually-edit-mastercam-g-code).

## The limit you must respect

Notepad++ is a text editor, full stop. It does not simulate the toolpath, catch a modal error, or know whether a move clears your fixture. Reading and lightly editing a program there is fine, but a clean looking file in Notepad++ is not a verified file. Treat the editor as a way to read and understand code, then verify the program properly on the machine before you trust it.

## Read faster by knowing the words cold

Color helps, but it only pays off if you actually know what M08 or G43 means the instant you see it. If you are still translating each code, reading stays slow no matter how good your highlighting is. The editor can show you that a line is an M-code by coloring it, but only your own memory tells you that M08 is coolant on.

That recognition is recall, and recall grows with short repeated practice. The free G-Code Sprint app at GCodePractice.com runs 60-second rounds on the common G and M codes and repeats whatever you miss, so the highlighted words in your files turn into instant meaning. It is an educational practice tool for building reading fluency, not a simulator or a controller. Set up your Notepad++ once, drill the codes a few minutes a day, and opening a program file stops feeling like decoding.

## Frequently asked questions

### How do you read a G-code file in Notepad++?

Open the .nc, .tap, or .txt file, turn on line numbers and a monospace font from the View menu, and add a User Defined Language so G, M, T, S, F, and coordinate words are color coded. Then read the program in blocks by word type rather than left to right. Notepad++ only makes the file legible, so verify the program on the machine. To make the codes register instantly, the free G-Code Sprint app at GCodePractice.com drills them in 60-second recall rounds.

### Does Notepad++ have G-code syntax highlighting?

Not built in, but it supports a User Defined Language you configure once, and importable G-code UDL files exist that color G words, M words, and coordinates. You set up keyword groups for G-codes, M-codes, and parameter letters, save the language, and every G-code file is colored automatically after that.

### Can Notepad++ simulate or verify G-code?

No. It is a text editor, not a simulator. It will not catch a modal error, check fixture clearance, or run the program. Use it to read and edit, then verify with a backplotter and a careful first run on the machine.

### What file extensions do G-code programs use?

Common ones are .nc, .tap, .cnc, .ngc, and sometimes .txt. Notepad++ opens all of them as text, so confirm the real extension is not hidden behind a second one like .nc.txt, which can stop a control from loading the file.

### Is it safe to edit G-code in Notepad++?

It is safe for small value changes if you keep the block structure, watch decimals, and back up the original. It is risky to delete or reorder lines because G-code is modal, so one change can alter the meaning of everything after it. Always re-read the block and verify on the machine after editing.

### What is the best monospace font for reading G-code?

Any clean, fixed-width font that clearly distinguishes similar characters, such as zero from the letter O, helps a lot. The key features are even spacing so columns line up and high legibility at the size you read from, which reduces misreads on coordinates.

---

Source: https://gcodepractice.com/journal/how-to-read-a-g-code-file-in-notepad/
Author: Lawrence Arya — https://www.linkedin.com/in/vibecoding/
