What is the AHK file format?
.ahk is a plain-text script file used by the AutoHotkey application. AutoHotkey is used for automating GUI tasks and keyboard and mouse interactions by executing code in .ahk files. .ahk files can be edited manually with any text editor, but the process requires working knowledge of the AutoHotkey scripting language. Errors in .ahk files may cause the script to not work properly or at all.
The AutoHotkey program is capable of automating execution of pointer and keyboard commands in various applications, including games, and can be used to create macros and hotstrings. AutoHotkey offers users the option to create custom key mappings to launch scripts or trigger actions. Scripts typically include directives such as #Requires AutoHotkey v2.0 or #SingleInstance Force, hotkey definitions, functions, and comments beginning with ;.
As of December 2022, AutoHotkey v2 introduced a modernized syntax incompatible with v1; v1.1 remains actively maintained. .ahk scripts can also be compiled to a standalone .exe using the included Ahk2Exe tool. Like .bat and .ps1 scripts, .ahk files are human-readable plain text but carry significant system access - always inspect untrusted scripts before running.
Security & safety
RISK: MEDIUMAn .ahk is executable automation: it can send keystrokes, move the mouse, read/write files, run programs and access the network, so a malicious script can do real harm even though the file is plain text. Always open an unfamiliar .ahk in a text editor first and read it before running - never blindly double-click one received by email or download. Compiled .ahk-to-.exe versions hide the source, so treat unknown AutoHotkey EXEs with the same caution as any downloaded program. AutoHotkey itself is safe; download it only from autohotkey.com.
Format details
in a nutshellPrograms that open AHK files
Technical details
deep spec| MIME type | text/plain (no dedicated MIME; some servers fall back to application/octet-stream) |
| Character encoding | UTF-8 (leading BOM EF BB BF common) or ANSI; v1 also reads the system codepage |
| File signature | None - plain text; v2 scripts commonly open with #Requires AutoHotkey v2.0 |
| Language versions | Two incompatible syntax generations: v1 (legacy, maintained as v1.1) and v2 (modern, released December 2022) |
| Operating system | Windows only; no official runtime for macOS or Linux |
| Execution method | Interpreted at runtime by AutoHotkey.exe; scripts can also be invoked from the command line |
| Compilation | Compiles to a standalone .exe via the bundled Ahk2Exe tool, which packages the interpreter and script together |
| Script constructs | Hotkey labels (e.g. ^j::MsgBox), hotstrings, directives (#Requires, #SingleInstance), functions, classes (v2), and labels |
| Typical file size | A few hundred bytes to tens of KB (plain text source) |
| Developer / maintainer | Originally created by Chris Mallett (2003); now maintained by the AutoHotkey Foundation and community (lead: Lexikos) |
| System access scope | Full access to keyboard input, mouse, file system, clipboard, and running processes |
| Common use cases | GUI automation, custom hotkeys, text expansion via hotstrings, window management, scripted file operations |
| v2 breaking changes | Mandatory parentheses for function calls, expression-mode by default, stricter variable scoping - backward-incompatible with v1 |
| Common directives | #Requires, #SingleInstance, #Include, #NoEnv (v1 only), #Warn |
| Released | 2003 (AutoHotkey 1.0) |
| Latest version | AutoHotkey v2 (v2.0 released December 2022; v1.1 still maintained) |
| Open standard | Yes · royalty-free |
| Specification | www.autohotkey.com |
AHK conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about AHK files.