GML Snippet Maker

GML syntax highlighting and pretty-printing allows GameMaker developers to generate stylized GameMaker Language code snippets they can put on their own websites. To get started, simply write or paste GML code in the text boxes below. There's also some settings you can customize. Once you're happy with how your code looks, click the big blue "View the HTML/CSS" button to get your code. To see the snippets in the context of an actual blog post, check out my article, 20 GameMaker tips.

What you see is what you get

Paste your GML below


Get your code here

1. CSS and JavaScript

Copy the code below and paste it between your webpage's <head></head> tags. This code handles the styling for all of the GML snippets on a given page, so you only need it once per page.

2. HTML Output

Copy the code below and paste it where you desire between your webpage's <body></body> tags. This code will create the code snippet seen at the top of the webpage.

This GameMaker tool features:

  • Color-coded syntax near-identical to what you'll find in GameMaker Studio 2.x.
  • Adaptive sizing for mobile and desktop devices
  • In-function documentation linking to help you learn GameMaker syntax
  • Local, global, and resource-level variable scoping
  • Clipboard copying support
  • Macros, enums, and regions
  • Faux resource referencing (sprite*, object*, spr_*, obj_*)

Frequently Asked Questions

This section answers some questions you may have surrounding and the tools it offers.

Why did you make GMLsnip and why is it free?

My name is Zack Banack and I've been making games for over a decade. This tool was originally going to be exclusive to The Step Event, an educational GameMaker side project of mine. But, I quickly realized a lot of people could get use out of a utility like this.

I'm keeping GMLsnip free because I believe in free coding resources. My mission of The Step Event is to create the tutorials and resources I wish I had when I was new to game development. Plus, the GameMaker community is a small and tight-knit one.

How can I support GMLsnip?

If you want to support this project, you can disable ad blocking software for this page. If you're feeling highly generous, there's a link to buy me a cup of coffee at the bottom of the page. Donations are completely optional but highly appreciated!

Why am I getting a message saying I need JavaScript?

GMLsnip needs JavaScript in order to make sense of the GML code you input. It runs a lexer, something that tokenizes (categorizes), strings of text. That's how this tool is able to distinguish variables from functions and numbers from strings. Fortunately, after the code snippet is generated, JavaScript is no longer needed.

Why doesn't my code look right?

There may be syntax edge-cases. Also, this utility is not a code validator nor a linter.

Why is the code so big?

Because the snippets generated by GMLsnip do not require JavaScript, they cannot be pretty-printed on the fly. While this means they're viewable to a larger percentage of the internet, it comes at the expense of being more bloated. The elements in the HTML, CSS, and clipboard script are named the way they are as to have a slim-to-none chance of interferring with anything else on your website. Overkill? Probably.

Why isn't the clipboard working?

While most modern JavaScript-enabled browsers should be able to copy the content via the clipboard button, some (notably, mobile) still fail. Luckily, the code can be manually highlighted and either right-click -> copy'd or ctrl/command + c'd.

Can I remove the attributions and credit in the code?

I highly encourage you to keep the credits and link back to in the code that's generated on this website. If you must remove the credits, then please consider making a donation below as compensation.

Is GMLsnip affiliated with YoYo Games or GameMaker?

No. This website is not — nor does it claim to be — affiliated with YoYo Games Ltd., GameMaker: Studio, GameMaker Studio 2, or any related products.

Will my snippets still work if goes down?

Yes! Once you copy and paste the code from this website onto yours, it's completely independent from

Can I edit the code this website generates?

You can do with this code as you please, bearing in mind the aforementioned attribution clause. But, if you edit the code, I won't be able to help you if something breaks.

Can we affiliate?

For questions regarding affiliation, please contact me.

♥  Buy Me a Coffee

Want something colorful? Check out my color encyclopedia, 2020 Colors!