---
schema_version: "1"
id: df2c92019c1a82414057d6f05b2f24dcfe32814a695c56185b4e10a26b780000
title: Create and Register Your Namespace for Second-Generation Managed Packages
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform-pkg-exchange/managed_packaging/guides/second-generation/sfdx-dev-dev2gp-create-namespace.md
canonical_url: https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-dev2gp-create-namespace.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: eb38e6398765fea86328226798d8d4a6101d83884ee7a02988927045a26ad736
products:
  - Second-Generation Managed Packaging Developer Guide
  - merged-docs
---

# Create and Register Your Namespace for Second-Generation Managed Packages

With second-generation managed packaging (managed 2GP), you can share a single namespace with multiple packages. Since sharing of code is much easier if your package shares the same namespace, we recommend that you use a single namespace for all of your managed 2GP packages.

To create a namespace:

1.  Sign up for a new Developer Edition org.
2.  In Setup, enter `Package Manager` in the Quick Find box, and select **Package Manager**.
3.  In Namespace Settings, click **Edit**.
4.  Enter a namespace and select **Check Availability**.
5.  (Optional) Select a package to associate with this namespace , or select **None**, then click **Review**.
6.  Review your selections, and then click **Save**.

To register a namespace:

1.  To link the namespace that you created with your Dev Hub, use Namespace Registry. See [Link a Namespace to a Dev Hub Org](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_reg_namespace.htm) for details.
2.  In the `sfdx-project.json` file, specify your namespace using the namespace attribute. When you create a new 2GP package, the package is associated with the namespace specified in the `sfdx-project.json` file.

**See Also**

- [Namespaces for Second-Generation Managed Packages](https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_dev_dev2gp_plan_namespaces.htm)
- [Link a Namespace to a Dev Hub Org](https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_dev_reg_namespace.htm)
- [Avoid Namespace Collisions in Second-Generation Managed Packages](https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/sfdx_dev_dev2gp_namespace_collisions.htm)
