Skip to content

allowlist / denylist

NextDNS Blocker provides two command groups for managing domain lists with full CRUD operations: allowlist and denylist.

Manage NextDNS denylist (blocked domains).

SubcommandDescription
denylist listList all domains in the denylist
denylist addAdd one or more domains
denylist removeRemove one or more domains
denylist exportExport to JSON or CSV
denylist importImport from file

Manage NextDNS allowlist (whitelisted domains).

SubcommandDescription
allowlist listList all domains in the allowlist
allowlist addAdd one or more domains
allowlist removeRemove one or more domains
allowlist exportExport to JSON or CSV
allowlist importImport from file

List all domains currently in your NextDNS denylist.

Terminal window
nextdns-blocker denylist list

Output:

Denylist
Domain Active
────────────────────────────
reddit.com Yes
twitter.com Yes
instagram.com Yes
tiktok.com No
Total: 4 domains

Add one or more domains to the denylist.

Terminal window
nextdns-blocker denylist add DOMAIN [DOMAIN ...]

Example:

Terminal window
nextdns-blocker denylist add reddit.com twitter.com instagram.com

Output:

+ reddit.com
+ twitter.com
+ instagram.com
Added 3 domain(s) to denylist

Remove one or more domains from the denylist.

Terminal window
nextdns-blocker denylist remove DOMAIN [DOMAIN ...]

Example:

Terminal window
nextdns-blocker denylist remove reddit.com

Output:

- reddit.com
Removed 1 domain(s) from denylist

Export denylist to a file.

Terminal window
nextdns-blocker denylist export [--format json|csv] [-o FILE]

Options:

OptionDefaultDescription
--formatjsonOutput format (json or csv)
-o, --outputstdoutOutput file path

Examples:

Terminal window
# Export to JSON file
nextdns-blocker denylist export -o denylist.json
# Export to CSV
nextdns-blocker denylist export --format csv -o denylist.csv
# Print to stdout
nextdns-blocker denylist export

JSON format:

[
{"domain": "reddit.com", "active": true},
{"domain": "twitter.com", "active": true}
]

CSV format:

domain,active
reddit.com,True
twitter.com,True

Import domains from a file.

Terminal window
nextdns-blocker denylist import FILE [--dry-run]

Options:

OptionDescription
--dry-runPreview what would be imported

Supported formats:

  • JSON: Array of strings or objects with domain field
  • CSV: Must have domain column, optional active column
  • Plain text: One domain per line (lines starting with # are ignored)

Examples:

Terminal window
# Preview import
nextdns-blocker denylist import domains.json --dry-run
# Import from file
nextdns-blocker denylist import domains.txt

Output:

Importing 25 domains...
Added: 20
Skipped (existing): 5
Failed: 0

List all domains currently in your NextDNS allowlist.

Terminal window
nextdns-blocker allowlist list

Output:

Allowlist
Domain Active
────────────────────────────
aws.amazon.com Yes
github.com Yes
Total: 2 domains

Add one or more domains to the allowlist.

Terminal window
nextdns-blocker allowlist add DOMAIN [DOMAIN ...]

Example:

Terminal window
nextdns-blocker allowlist add github.com stackoverflow.com

Output:

+ github.com
+ stackoverflow.com
Added 2 domain(s) to allowlist

Remove one or more domains from the allowlist.

Terminal window
nextdns-blocker allowlist remove DOMAIN [DOMAIN ...]

Example:

Terminal window
nextdns-blocker allowlist remove github.com

Output:

- github.com
Removed 1 domain(s) from allowlist

Export allowlist to a file.

Terminal window
nextdns-blocker allowlist export [--format json|csv] [-o FILE]

Example:

Terminal window
nextdns-blocker allowlist export -o allowlist.json

Import domains from a file.

Terminal window
nextdns-blocker allowlist import FILE [--dry-run]

Example:

Terminal window
nextdns-blocker allowlist import work-domains.txt

The single-domain allow and disallow commands are still available for quick operations.

The allowlist is used to:

  • Create subdomain exceptions: Allow aws.amazon.com while blocking amazon.com
  • Override category blocks: Allow specific domains blocked by NextDNS categories
  • Permanent access: Keep domains always accessible

Add a domain to the allowlist.

Terminal window
nextdns-blocker allow DOMAIN
Terminal window
nextdns-blocker allow aws.amazon.com
Adding 'aws.amazon.com' to allowlist...
✓ Domain added to allowlist
Note: This creates a permanent exception.
For scheduled access, edit config.json directly.
  1. Adds domain to NextDNS allowlist immediately
  2. Adds domain to local config.json allowlist
  3. Domain will remain in allowlist across syncs

The allow command creates permanent (always-allowed) entries. For time-based allowlist entries, edit config.json:

Terminal window
nextdns-blocker config edit
{
"allowlist": [
{
"domain": "youtube.com",
"description": "Evening only",
"schedule": {
"available_hours": [
{
"days": ["monday", "tuesday", "wednesday", "thursday", "friday"],
"time_ranges": [{"start": "20:00", "end": "22:30"}]
}
]
}
}
]
}

Remove a domain from the allowlist.

Terminal window
nextdns-blocker disallow DOMAIN
Terminal window
nextdns-blocker disallow aws.amazon.com
Removing 'aws.amazon.com' from allowlist...
✓ Domain removed from allowlist
  1. Removes domain from NextDNS allowlist immediately
  2. Removes domain from local config.json allowlist
  3. Domain is now subject to normal blocking rules

With shell completion enabled, allowlist domains auto-complete:

Terminal window
nextdns-blocker disallow aws<TAB>
# Completes to: nextdns-blocker disallow aws.amazon.com

NextDNS processes lists with these priority rules:

PriorityListResult
1 (Highest)AllowlistDomain is ALLOWED
2Blocklist/DenylistDomain is BLOCKED
3Category blocksDomain is BLOCKED
4DefaultDomain is ALLOWED
  • Allowlist always wins over blocklist
  • Use for subdomain exceptions
  • Use to override category blocks

Block a domain but allow a specific subdomain:

Terminal window
# In config.json blocklist
{"domain": "amazon.com", "schedule": null}
# Allow the exception
nextdns-blocker allow aws.amazon.com

Result:

  • amazon.com → Blocked
  • www.amazon.com → Blocked (inherits from parent)
  • aws.amazon.comAllowed (allowlist override)
  • console.aws.amazon.comAllowed (inherits from allowlist)

If NextDNS blocks a domain via category (e.g., “Streaming”):

Terminal window
# Allow specific streaming site during certain hours
nextdns-blocker allow youtube.com

Or for scheduled access, edit config:

{
"allowlist": [
{
"domain": "youtube.com",
"schedule": {
"available_hours": [
{
"days": ["saturday", "sunday"],
"time_ranges": [{"start": "10:00", "end": "22:00"}]
}
]
}
}
]
}

Keep work-related domains always accessible:

Terminal window
nextdns-blocker allow docs.google.com
nextdns-blocker allow github.com
nextdns-blocker allow stackoverflow.com

When panic mode is active:

  • The allow command is hidden
  • The disallow command is hidden
  • Scheduled allowlist sync is skipped
  • This prevents bypassing emergency lockdown

After panic expires:

  • Commands become available again
  • Scheduled allowlist syncing resumes
Terminal window
nextdns-blocker status

Shows:

Allowlist (2 domains):
✓ aws.amazon.com ALLOWED (always)
✓ youtube.com ALLOWED (until 22:30)
Terminal window
nextdns-blocker config show

Shows:

Allowlist (2 domains):
aws.amazon.com
Description: Work resource
Schedule: null (always allowed)
youtube.com
Description: Evening entertainment
Schedule: Sat-Sun 10:00-22:00

A domain cannot be in both blocklist and allowlist:

Terminal window
# If reddit.com is in blocklist
nextdns-blocker allow reddit.com

Output:

Error: 'reddit.com' is in the blocklist
Remove from blocklist first, or use a subdomain exception

You can have:

  • amazon.com in blocklist
  • aws.amazon.com in allowlist

This is valid and will show a warning during config load.

  1. Check if domain is in blocklist:

    Terminal window
    nextdns-blocker config show | grep <domain>
  2. Clear DNS cache:

    Terminal window
    # macOS
    sudo dscacheutil -flushcache
    # Linux
    sudo systemctl restart systemd-resolved
    # Windows
    ipconfig /flushdns
  3. Force sync:

    Terminal window
    nextdns-blocker config push

Panic mode is active. Check status:

Terminal window
nextdns-blocker panic status

Wait for panic to expire.

Check for API errors:

Terminal window
nextdns-blocker config push --verbose

Verify credentials:

Terminal window
nextdns-blocker init