Firewall Rule Converter
Translate iptables, nftables, UFW, firewalld and AWS security-group rules with a field-by-field explanation.
Source rules
nftables output
Paste rules to see the translated output
Pick the source format, choose a target, and review the explanation table below.
Details
Paste an iptables ruleset, an nftables table, UFW commands, firewalld rich rules or an AWS security-group JSON document and translate it into any of those grammars. The converter normalizes every rule into an intermediate representation — chain, family, protocol, addresses, interfaces, ports, conntrack states, limits, verdicts and comments — then emits the selected target from that shared form. A provenance-driven explanation table maps each source token to its target syntax and explains the semantic difference: conntrack is explicit in iptables and nftables but implicit in UFW and security groups; security groups are allow-only; rich rules describe inbound traffic and have no conntrack match. Unsupported match extensions such as -m string are never dropped silently — they appear as TODO comments, warnings and explanation rows. Chain policies from iptables-save output become nft chain policies, so a default-deny ruleset stays default-deny. Translation changes syntax, not security intent: always review the output and dry-run it with `nft -c` or `iptables-restore --test` before applying anything.
More examples
iptables to nftables migration
-A INPUT -p tcp -s 10.0.0.0/8 --dport 22 -m state --state NEW -j ACCEPT
=> ip saddr 10.0.0.0/8 tcp dport 22 ct state new counter acceptAddresses, ports and conntrack states move into nftables clauses in canonical order; the counter replaces iptables' implicit packet accounting.
Default-deny policy preserved
*filter
:INPUT DROP [0:0]
-A INPUT -i lo -j ACCEPT
COMMIT
=> chain INPUT { type filter hook input priority 0; policy drop; }Chain policies parsed from iptables-save become nft chain policies, preventing an accidental flip from default-deny to default-accept.
AWS security group to iptables
{"IpPermissions":[{"IpProtocol":"tcp","FromPort":443,"ToPort":443,"IpRanges":[{"CidrIp":"0.0.0.0/0"}]}]}
=> -A INPUT -s 0.0.0.0/0 -p tcp --dport 443 -j ACCEPTIngress permissions become INPUT rules; egress permissions become OUTPUT rules, with IPv4 and IPv6 ranges routed to the right address field.
Unsupported matches flagged
-A INPUT -m string --string "bad" --algo bm -j DROP
=> # TODO: -m string — no nftables equivalentConstructs without a target equivalent produce warning chips and inline TODO comments instead of disappearing from the translated ruleset.
Examples
SSH rule with conntrack and limits
-A INPUT -p tcp -s 10.0.0.0/8 --dport 22 -m state --state NEW -m limit --limit 3/minute --limit-burst 5 -j ACCEPTip saddr 10.0.0.0/8 tcp dport 22 ct state new limit rate 3/minute burst 5 packets counter acceptAddresses, ports, states and rate limits land in canonical nftables clause order; iptables' implicit accounting becomes an explicit counter.
Default-deny policy survives the migration
*filter
:INPUT DROP [0:0]
-A INPUT -i lo -j ACCEPT
COMMITchain INPUT { type filter hook input priority 0; policy drop; }
iifname "lo" counter acceptWithout policy parsing, a default-deny ruleset would silently become default-accept in nftables.
Security group to host firewall
{"IpPermissions":[{"IpProtocol":"tcp","FromPort":443,"ToPort":443,"IpRanges":[{"CidrIp":"0.0.0.0/0"}]}]}-A INPUT -s 0.0.0.0/0 -p tcp --dport 443 -j ACCEPTIngress becomes INPUT, egress becomes OUTPUT; IPv6 ranges are routed to Ip6 clauses or -s ::/0 as appropriate.
Unsupported match stays visible
-A INPUT -m string --string "bad" --algo bm -j DROP# TODO: -m string — no nftables equivalent
# TODO: --algo — no nftables equivalent
counter dropThe rule is translated with comments and warnings instead of quietly losing its match conditions.
About this tool
Moving a ruleset from iptables to nftables — or from an on-prem host to a cloud security group — is mostly mechanical, but the grammars disagree about state, verdicts and defaults. This converter parses rules into a normalized intermediate representation and emits them in the grammar you choose, with a table that explains every token it moved.
Five source formats are accepted: iptables (including iptables-save scaffolding and chain policies), nftables, UFW command lists, firewalld rich rules and AWS security-group JSON. Five targets are available, including the reverse direction: a describe-security-groups response can become iptables rules for an on-prem host. Change the source tab or the target selector and the whole ruleset is re-parsed immediately.
The explanation table is the point of the tool. Each source token is paired with its target syntax and a semantics note: `-m state ESTABLISHED,RELATED` becomes `ct state established,related` in nftables but is implicit in UFW; a DROP rule cannot be expressed in an allow-only AWS security group; a rich rule cannot match conntrack state. Per-rule status chips mark converted, partial and review-needed rules.
Unsupported constructs are never thrown away. `-m string`, unknown options, user-defined jumps and security-group-to-security-group references appear as warning chips, TODO comments in the output and rows in the explanation table. Rulesets are processed entirely in the browser tab — nothing is uploaded, logged or saved.
What this tool does not do
- Translation is syntax-level: it does not prove that the target ruleset has the same security meaning.
- The filter table is the focus; NAT, mangle and user-defined chain creation are reported but not fully translated.
- AWS security groups cannot express deny rules, negated addresses or references to other security groups; those rules are skipped with warnings.
- firewalld rich rules describe inbound traffic only, so OUTPUT/FORWARD rules are emitted as TODO comments.
- Generated syntax should be validated with the target toolchain (nft -c, iptables-restore --test) before deployment.
How to use this tool
Choose the source format
Pick iptables, nftables, UFW, firewalld or AWS SG JSON. Paste a ruleset or load one of the example chips; the tool also suggests a format when it recognises one.
Pick a target grammar
Use the Target selector. Output and explanations update immediately, so you can compare nftables, iptables, UFW, firewalld and SG JSON without losing the parsed rules.
Review warnings and status chips
Each rule is marked Converted, Partial or Review. Warning banners explain lost semantics such as implicit conntrack, skipped deny rules and unsupported match modules.
Read the explanation table
Hover a status chip to highlight its source tokens. The table maps every token to target syntax and explains the semantic difference; copy it as Markdown for a migration ticket.
Dry-run before applying
Copy or download the generated rules, then validate them with the target stack (`nft -c` or `iptables-restore --test`). The tool translates syntax, not security intent.
Use cases
Migrate a legacy iptables host
Paste filtered iptables-save output, choose nftables and review the per-field explanation table before testing with nft -c.
Port on-prem rules to a cloud security group
Turn allow rules into IpPermissions JSON with separated IPv4/Ipv6 ranges, while deny rules are flagged as not representable.
Recreate a cloud ruleset locally
Paste a describe-security-groups response and generate iptables lines for parity testing on a lab host.
Audit semantic drift
Compare the same ruleset in two grammars and see exactly where conntrack, logging, policies or rate limits change meaning.
Source and target dialects
| Dialect | What the converter reads and writes |
|---|---|
| iptables | -A/-I rules, -P policies and iptables-save scaffolding; match modules including state/conntrack, limit, comment, multiport, icmp-type and tcp-flags |
| nftables | inet table and chain declarations, ip/ip6 saddr and daddr, iifname/oifname, ct state, limit rate, sets, counter and verdicts |
| UFW | ufw default policies, allow/deny/reject/limit actions, insert N ordering, from/to addresses, port, proto and comments |
| firewalld | rich rules with family, source/destination address, port/protocol pairs and accept/reject/drop actions |
| AWS SG JSON | IpPermissions (ingress → INPUT) and IpPermissionsEgress (egress → OUTPUT), with IpRanges, Ipv6Ranges, FromPort/ToPort and descriptions |
Security groups are allow-only: DROP and REJECT rules are reported and omitted from SG JSON rather than silently downgraded to ALLOW.
Common mistakes
Mistake:Applying generated nftables rules without checking the chain policy.
Fix:The emitter preserves policies parsed from -P/iptables-save; verify the `policy drop;` line in the chain scaffold before applying.
Mistake:Assuming a DROP rule becomes a deny entry in AWS SG JSON.
Fix:Security groups are allow-only. The converter reports the skipped rule with a warning; use a network ACL or WAF for explicit denies.
Mistake:Expecting UFW to preserve explicit ESTABLISHED,RELATED matches.
Fix:UFW is stateful by default, so those matches are implicit and the explanation table says so. Read the info warning before deleting the rule.
Mistake:Treating a converted comment as a security control.
Fix:TODO comments document unsupported matches such as -m string; they do not enforce the match. Re-implement those rules by hand.
Mistake:Feeding NAT rules and expecting a full translation.
Fix:This tool focuses on the filter table. NAT/mangle rules are flagged as out of scope and must be migrated separately.
Frequently asked questions
How do stateful rules translate between these firewalls?
iptables uses explicit `-m state --state ESTABLISHED,RELATED`; nftables uses `ct state established,related`; UFW and AWS security groups are stateful by default, so the match is implicit and the explanation table says so. The converter keeps the rule and records the semantic note rather than dropping the state match silently.
What happens to unsupported matches such as -m string?
They are never dropped. Unknown match modules, options and user-defined chain jumps become warning chips, `# TODO: …` comments in the output and rows in the explanation table. The rule still emits its supported clauses and verdict, so you can see both what translated and what needs a manual rewrite.
Does this convert NAT or mangle rules?
No. The tool focuses on the filter table. A rule from another table is flagged with a warning and a pass-through comment; SNAT, DNAT and masquerade need to be migrated separately. NAT support is an explicit future enhancement, not a hidden feature.
Is UFW rule ordering preserved?
The position from `iptables -I CHAIN N` is kept as `ufw insert N`, with a note that UFW evaluates the first matching rule. If the source uses append semantics, the generated lines are emitted in the same order as the ruleset. Re-check the numbering on the target host before reloading UFW.
Can it parse cloud security-group JSON back into iptables?
Yes. Ingress `IpPermissions` become INPUT rules and `IpPermissionsEgress` become OUTPUT rules. IPv4 `IpRanges` and IPv6 `Ipv6Ranges` land in the correct address field, `FromPort`/`ToPort` becomes a port range, and range descriptions become comments. The full `describe-security-groups` response shape is accepted too.
Why are DROP and REJECT rules missing from AWS SG JSON?
Security groups are allow-only lists, so there is no deny action to emit. Those rules are counted in the skipped total, reported in a warning with the source line, and left out of the JSON rather than downgraded to ALLOW — a silent downgrade would change traffic policy.
Are default-deny policies preserved?
Yes. `-P INPUT DROP` and iptables-save lines such as `:INPUT DROP [0:0]` are parsed into chain policies and emitted as `policy drop;` in the nftables chain scaffold. UFW output gets a `# ufw default deny incoming` note instead, because UFW policies are managed separately from individual rules.
Is my ruleset uploaded or stored anywhere?
No. Parsing, emission and the explanation table all run in JavaScript inside this browser tab. There is no network request, no account and no localStorage entry for rule content; closing the tab discards it. Only the clipboard action you trigger copies text out.
Can I trust the generated rules without testing them?
Treat the output as a reviewed draft. The tool translates syntax, not security intent, and target versions differ. Dry-run with `nft -c` or `iptables-restore --test`, and use the explanation table to confirm that semantics such as conntrack, logging and rate limits still match your policy.
References & standards
Related tools
AES Encryption
Encrypt and decrypt text with AES-GCM and a passphrase, fully in your browser. Uses PBKDF2 key derivation and the Web Crypto API — your data and keys never leave your device.
Android Network Security Config Builder
Generate network_security_config.xml with cleartext rules, trust anchors, certificate pinning and debug-only CAs — plus the manifest snippet and file placement checklist.
Ansible Vault Encrypt/Decrypt
Encrypt secrets into $ANSIBLE_VAULT;1.1;AES256 format or decrypt vault content with its password — locally in your browser, drop-in compatible with ansible-vault.
Argon2 Hash Generator & Verifier
Generate Argon2id/2i/2d hashes with proper m/t/p parameters and verify PHC strings — reference algorithm in your browser, nothing uploaded.
AWS Signature V4 Builder
Build AWS Signature V4 headers and presigned URLs from a canonical request — signed curl, key chain and debug diff, computed locally in your browser.
Basic Auth Generator
Generate an HTTP Basic Authentication header from a username and password. Produces the Authorization header and ready-to-use curl and fetch snippets. Runs fully client-side.