YARA Rule Builder and Linter
Two ways to get to a clean YARA rule. Build one from a form: name, tags, meta, strings (text, hex or regular expression, with modifiers) and a condition, written out in standard formatting for you to copy. Or lint a rule you already have: paste it and get findings with line numbers, from unbalanced braces and unused strings to bad hex syntax and missing meta.
Nothing is executed and no file is scanned. The tool reads and writes rule text in your browser and uploads nothing. The examples use harmless demo text only, never malware signatures.
This tool only writes and reads rule text in your browser. It does not run YARA, does not scan any file and uploads nothing. Test a finished rule with YARA on files you are allowed to scan.
Rule details
Your rule
YARA rule
rule unnamed_rule
{
meta:
author = ""
description = ""
date = ""
strings:
$s1 = ""
condition:
any of them
}
To fix before you use it (2)
- Rule name is empty.
- $s1 is empty.
The text is built in your browser and is not run or tested here. The form checks structure only: whether a rule matches the right files, and only those, is for you to test.
Loading…
Sample report · illustrative data
Sample result: lint findings for a demo YARA rule
Example run of the linter on a ten-line demo rule with deliberate mistakes. The rule uses harmless demo text only and matches no real malware.
Summary
- Rules read
- 1 (Demo_Needs_Work, tag: demo)
- Strings defined
- 4
- Errors
- 5
- Warnings
- 4
Findings
| Severity | Line | Check | Finding |
|---|---|---|---|
| Error | 5 | Strings | String $a is defined twice (first on line 4). |
| Error | 6 | Strings | String $unused is defined but never used in the condition. YARA rejects a rule with an unused string. |
| Error | 7 | Hex string | $hex: A byte is missing a digit. Hex bytes come in pairs, such as 4D or ??. |
| Error | 7 | Strings | String $hex is defined but never used in the condition. YARA rejects a rule with an unused string. |
| Error | 9 | Condition | The condition uses $missing, but $missing is not defined in strings. |
| Warning | 1 | Meta | No "author" in meta. Add it so the next person knows who wrote the rule. |
| Warning | 1 | Meta | No "description" in meta. Add it so the next person knows what the rule is for. |
| Warning | 1 | Meta | No "date" in meta. Add it so the next person knows how old the rule is. |
| Warning | 4 | Short string | $a is only 2 characters long. Short strings match many clean files. Aim for 4 or more, or pair it with other strings. |
What the Build tab produces for the demo form
- Rule name Demo_Marker_Example with tags demo and training
- Meta: author, description, date and version
- Four strings: two text strings (EXAMPLE_MARKER and the EICAR test file marker), one hex string with two wildcard bytes, one regular expression
- Condition: filesize < 500KB and 2 of them
What this is and is not
The linter reads rule text in your browser. It does not run YARA, scan files or upload anything, and it is not the YARA compiler: a rule that passes these checks can still be rejected by YARA. Test a finished rule on files you are allowed to scan.
Made-up example data. Your own run uses your inputs. Downloads of the full report need Pro.
TL;DRWhat this tool does
5 points
- Build: fill in a rule name, tags, meta entries, strings (text, hex or regular expression, with nocase, wide, ascii and fullword) and a condition, and get a formatted YARA rule to copy.
- The condition helper covers "any of them", "all of them", "N of them" or your own condition, with optional file size limit and a Windows executable check (uint16(0) == 0x5A4D).
- Lint: paste a rule and get findings with line numbers: unbalanced braces, invalid names, duplicate, unused or undefined strings, a missing condition, bad hex syntax, very short strings and missing author, description or date.
- Nothing is executed and no file is scanned. The tool reads and writes rule text in your browser and uploads nothing.
- Examples use harmless demo text only (EXAMPLE_MARKER and the EICAR test file marker). There are no malware signatures on this page.
The parts of a YARA rule
Every rule starts with the word rule and a name, then a body in braces with up to three sections, in this order. meta holds notes for people: who wrote the rule, what it is for and when. strings names the patterns to look for. condition is the only required section: a true-or-false expression that decides whether the rule matches.
rule Demo_Marker_Example : demo training
{
meta:
author = "Your name"
description = "Demo rule. Not a malware signature."
date = "2026-11-30"
strings:
$marker = "EXAMPLE_MARKER" wide ascii fullword
$hex_example = { 45 58 41 4D 50 4C 45 5F ?? ?? }
condition:
filesize < 500KB and any of them
}A harmless demo rule: it looks for the made-up text EXAMPLE_MARKER and matches no real malware.
| String type | Written as | Good for |
|---|---|---|
| Text | "EXAMPLE_MARKER" nocase | Readable text; modifiers handle case, two-byte text and whole words |
| Hex | { 45 58 ?? [2-4] 4D } | Raw bytes, with ?? for any byte and [2-4] for a gap of 2 to 4 bytes |
| Regular expression | /example-build-[0-9]{4}/ | Text that varies in a known way; keep some fixed text in it |
Writing rules that hold up
A rule that compiles is not yet a good rule. Prefer several specific strings over one short one, require more than one of them in the condition, and narrow the rule with a file size limit or a file type check so it is not tried against everything. Fill in author, description and date so the next analyst can judge the rule. Then test it with YARA on files you are allowed to scan: a set that should match and a larger set of clean files that should not. Practise the wider craft of writing and tuning detections in the Detection Lab, and check a pattern before you put it in a rule with the Regex Tester.
Frequently asked questions
What is a YARA rule?
A YARA rule is a short text description of a pattern to look for in files or memory. It has a name, optional tags and meta entries, a strings section that lists the text, hex bytes or regular expressions to find, and a condition that says which of those must be present for the rule to match.
How do I write a YARA rule with this builder?
Give the rule a name made of letters, digits and underscores. Add meta entries for author, description and date. Add one or more strings: plain text, hex bytes such as 45 58 41 4D with ?? for any byte, or a regular expression. Tick modifiers where they apply, for example nocase to ignore case or wide for two-byte text. Then pick the condition: any of them, all of them, a number of them, or your own. The rule text updates as you type and can be copied.
What does the linter check?
It reads the rule as text and reports: braces and parentheses that do not balance, rule names and tags that are not valid identifiers or are YARA keywords, duplicate rule names, string names defined twice, strings defined but never used, strings used in the condition but never defined, a missing or empty condition, hex strings with bad syntax, modifiers that do not exist or cannot be combined, text shorter than four characters, and missing author, description or date in meta. Each finding has a line number.
Does this tool run my rule or scan files?
No. Nothing is executed, no file is opened or scanned, and the rule text is not uploaded. The builder writes text and the linter reads text, both in your browser. The linter is not the YARA compiler, so a rule that passes here can still be rejected by YARA, and only testing against known clean and known matching files tells you whether a rule finds what you intend without false positives.
Why are short strings a problem in YARA rules?
A very short string, such as two or three bytes, appears by chance in a great many unrelated files. A rule that relies on it matches clean files, and scanning is slower because YARA has to check far more candidate positions. Prefer strings of four or more characters, combine several strings in the condition, and narrow the rule with checks such as file size or file type.
Does it cost anything?
A free account gets 3 runs in total, shared across every PlayCISO tool and lab, and the YARA Rule Builder and Linter is one of them. After that it needs Pro, $5/month or $40/year. Downloads and exports are Pro.
More tools like this
Related tools and labs, with new picks every day.