Enable dynamic First-Party Isolation (dFPI)
- Linux onlyThis script improves your privacy on Linux
- Single actionThis page belongs to a script, containing basic changes to achieve a task.
- Impact: Minimum
System Functionality / Data Loss Risk: Low
This action improves privacy with minimal impact when you run the recommended script.
- Bash (Shell script)These changes use Linux system commands to update your settings.
- Sudo/root requiredThis script requires privilege access to do the system changes
- Fully reversible
You can fully restore this action (revert back to the original behavior) using this website.
The restore/revert methods provided here can help you fix issues.
Overview
Dynamic First-Party Isolation, also known as dFPI, is an advanced privacy feature in Firefox. This feature commonly referred to as:
Essentially, dFPI is an enhanced version of a previous privacy tool known as First-Party Isolation (FPI) 4.
The primary purpose of dFPI is to improve user privacy online. It accomplishes this by preventing third-party websites from accessing or tracking a user's data across different websites 1 3.
By default, this feature is activated for all Firefox desktop users 5.
Within Firefox's settings, there's an option called network.cookie.cookieBehavior
which governs how dFPI operates.
This setting has three potential values 3:
5
: The browser will block known trackers and partition storage for third-party content.4
: Only known trackers will be blocked without any partitioning of third-party storage.0
: All trackers and third-party content are allowed.
This script sets the value to 5
, ensuring the highest level of privacy by blocking trackers and partitioning third-party
storage. This aligns with recommended privacy practices because even if you choose the 4
value, the older First-Party
Isolation (FPI) will still be active 6.
Sources
- Total Cookie Protection and website breakage FAQ. Firefox Help. (2023).
Original: https://support.mozilla.org/en-US/kb/total-cookie-protection-and-website-breakage-faq
Archived: https://web.archive.org/web/20231003094145/https://support.mozilla.org/en-US/kb/total-cookie-protection-and-website-breakage-faq - 1746646 - (tcp-mochitests) [meta] Make mochitests work with TCP enabled (cookieBehavior = 5). bugzilla.mozilla.org. (2023).
Original: https://bugzilla.mozilla.org/show_bug.cgi
Archived: https://web.archive.org/web/20231003094154/https://bugzilla.mozilla.org/show_bug.cgi?id=1746646 - State Partitioning - Privacy on the web. MDN. (2023).
Original: https://developer.mozilla.org/en-US/docs/Web/Privacy/State_Partitioning
Archived: https://web.archive.org/web/20230918172155/https://developer.mozilla.org/en-US/docs/Web/Privacy/State_Partitioning#disable_dynamic_state_partitioning - 1649876 - Migrate FPI users to dFPI. bugzilla.mozilla.org. (2023).
Original: https://bugzilla.mozilla.org/show_bug.cgi
Archived: https://web.archive.org/web/20231003094207/https://bugzilla.mozilla.org/show_bug.cgi?id=1649876#c5 - Firefox Rolls Out Total Cookie Protection By Default. (2023).
Original: https://blog.mozilla.org/en/products/firefox/firefox-rolls-out-total-cookie-protection-by-default-to-all-users-worldwide
Archived: https://web.archive.org/web/20231207105610/https://blog.mozilla.org/en/products/firefox/firefox-rolls-out-total-cookie-protection-by-default-to-all-users-worldwide/ - 1631676 - Disable dfpi when privacy.firstparty.isolate=true. bugzilla.mozilla.org. (2023).
Original: https://bugzilla.mozilla.org/show_bug.cgi
Archived: https://web.archive.org/web/20231003094350/https://bugzilla.mozilla.org/show_bug.cgi?id=1631676#c25
Apply Now
Choose one of three ways to apply:
Help
How to apply or restore "Enable dynamic First-Party Isolation (dFPI)" using script
- ≈ 3 min to complete
- Tools: Web Browser
- Difficulty: Medium
- ≈ 5 instructions
- 1
Download
Download the script file by clicking on thebutton above.
Use button above to restore changes. - 2
Keep the file
If warned by your browser, keep the file. - 3
Open
Open the downloaded file. - 4
Exit
Once it's done, press any key to exit the window. - 5
Restart
Restart your computer for all changes to take effect.
Apply with privacy.sexy
Guided, automated application with safety checks- Recommended for most users
- Includes safety checks
- Free
- Open-source
- Popular
- Offline/Online usage
Help
How to apply or restore "Enable dynamic First-Party Isolation (dFPI)" using privacy.sexy
- ≈ 3 min to complete
- Tools: privacy.sexy
- Difficulty: Simple
- ≈ 4 instructions
- 2
Choose script
- Search for the script name: Enable dynamic First-Party Isolation (dFPI)
- Check the script by clicking on the checkbox.
- 3
Run
Click on ▶️ Run button at the bottom of the page.This button only appears on desktop version (recommended). On browser, use 💾 Save button.
- Apply
- Revert
pref_name='network.cookie.cookieBehavior'
pref_value='5'
echo "Setting preference \"$pref_name\" to \"$pref_value\"."
declare -a profile_paths=(
~/.mozilla/firefox/*/
~/.var/app/org.mozilla.firefox/.mozilla/firefox/*/
~/snap/firefox/common/.mozilla/firefox/*/
)
declare -i total_profiles_found=0
for profile_dir in "${profile_paths[@]}"; do
if [ ! -d "$profile_dir" ]; then
continue
fi
if [[ ! "$(basename "$profile_dir")" =~ ^[a-z0-9]{8}\..+ ]]; then
continue # Not a profile folder
fi
((total_profiles_found++))
user_js_file="${profile_dir}user.js"
echo "$user_js_file:"
if [ ! -f "$user_js_file" ]; then
touch "$user_js_file"
echo $'\t''Created new user.js file'
fi
pref_start="user_pref(\"$pref_name\","
pref_line="user_pref(\"$pref_name\", $pref_value);"
if ! grep --quiet "^$pref_start" "${user_js_file}"; then
echo -n $'\n'"$pref_line" >> "$user_js_file"
echo $'\t'"Successfully added a new preference in $user_js_file."
elif grep --quiet "^$pref_line$" "$user_js_file"; then
echo $'\t'"Skipping, preference is already set as expected in $user_js_file."
else
sed --in-place "/^$pref_start/c\\$pref_line" "$user_js_file"
echo $'\t'"Successfully replaced the existing incorrect preference in $user_js_file."
fi
done
if [ "$total_profiles_found" -eq 0 ]; then
echo 'No profile folders are found, no changes are made.'
else
echo "Successfully verified preferences in $total_profiles_found profiles."
fi
InByZWZfbmFtZT0nbmV0d29yay5jb29raWUuY29va2llQmVoYXZpb3InXG5wcmVmX3ZhbHVlPSc1J1xuZWNobyBcIlJldmVydGluZyBwcmVmZXJlbmNlOiBcXFwiJHByZWZfbmFtZVxcXCIgdG8gaXRzIGRlZmF1bHQuXCJcbmlmIGNvbW1hbmQgLXYgJ3BzJyAmPiAvZGV2L251bGwgJiYgcHMgYXV4IHwgZ3JlcCAtaSBcIltmXWlyZWZveFwiID4gL2Rldi9udWxsOyB0aGVuXG4gID4mMiBlY2hvIC1lIFwiXFxlWzMzbVdhcm5pbmc6IEZpcmVmb3ggaXMgY3VycmVudGx5IHJ1bm5pbmcuIFBsZWFzZSBjbG9zZSBGaXJlZm94IGJlZm9yZSBleGVjdXRpbmcgdGhlIHJldmVydCBzY3JpcHQgdG8gZW5zdXJlIGNoYW5nZXM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kgdmVyaWZpZWQgcHJlZmVyZW5jZXMgaW4gJHRvdGFsX3Byb2ZpbGVzX2ZvdW5kIHByb2ZpbGVzLlwiXG5maSI=
Help
How to apply or restore "Enable dynamic First-Party Isolation (dFPI)" using commands
- ≈ 2 min to complete
- Tools: Terminal
- Difficulty: Medium
- ≈ 3 instructions
- 1
Open terminal
Open your terminal application. - 2
Copy code
Copy the code: - 3
Paste & run
Paste the commands into terminal application and press Enter to run.Some changes require a system restart to take effect
Similar Guides
Wider Goal
Guides below includes this guide to achieve a wider goal.See other more general settings that includes this one as one of its actions.
These plans combine multiple privacy settings, including this one, for stronger protection.
- Enable Firefox state partitioning (Total Cookie Protection)
- Harden Firefox privacy
- Configure Firefox
- Configure programs
Web browsers, including Firefox, save various data types such as cookies, cache, and site-specific details. While this data helps in providing a faster and persona...
The following are privacy-focused tweaks to prevent browser fingerprinting and tracking. See also: What is browser fingerprinting? | AmIUnique.org
Mozilla Firefox, colloquially known as Firefox, is a free and open-source web browser created by the Mozilla Foundation and its subsidiary, the Mozilla Corporation...
These scripts configure third-party applications installed on Linux distributions to harden their security and privacy to protect your data. They scripts differ fr...
Same Goal
Other guides in Enable Firefox state partitioning (Total Cookie Protection)See settings that are in the same category as this guide.
Using other actions in the same category may help you achieve your goal better.
About the Creators
These people have authored this documentation and written its scripts:
Reviewed By
This guide has undergone comprehensive auditing and peer review:Expert review by undergroundwires
- Verified technical accuracy and editorial standards
- Assessed system impact and user privacy risks
Public review by large community
- Privacy enthusiasts and professionals peer-reviewed
- Millions of end-users tested across different environments
History
We continually monitor our guides, their impact and all other privacy options. We update our guides when new information becomes available. On every update, we publicly store who made the change, what has been changed, why the change was made and when the change was made.