How to Choose @id for Schema

Websites and other online platforms often use structured data in order to provide more meaningful information to search engines. One of the key components of this structured data is the use of unique identifiers, or “@id” values, which help search engines identify and understand the relationship between different pieces of information on a website

In this blog post, let’s take a closer look at how to choose the @id for your schema markup, especially if you’re an SEO specialist looking to optimize your website.

What is @id in schema markup?

The @id in JSON-LD schema markup is a unique identifier (or IRI – Internationalized Resource Identifier) used to reference a specific entity or item.

The use of @id is essential for creating links between different pieces of data in a JSON-LD document. It allows you to uniquely identify resources, and it makes it possible to establish relationships between them.

Other parts of the document can then use this @id to reference the resource, creating a web of linked data. This is particularly useful when you want to define an entity once and reference it multiple times in different parts of your website.

For instance, if you have an organization that’s mentioned multiple times on your site, you can define it once with an @id and then simply refer to that @id whenever the same organization is mentioned, instead of having to redefine the same properties over and over again.

Here’s an example:

{
 "@context": "https://schema.org",
 "@type": "Organization",
 "@id": "http://www.example.com/#organization",
 "name": "Your Organization Name",
 "url": "http://www.example.com/"
}

You can then use the @id (http://www.example.com/#organization in this case) to refer to this organization elsewhere in your schema. For example:

{
 "@context": "https://schema.org",
 "@type": "Event",
 "organizer": {
   "@type": "Organization",
   "@id": "http://www.example.com/#organization"
 },
 "name": "Event Name",
 "startDate": "2023-10-25T00:00",
 "location": {
   "@type": "Place",
   "name": "Event Location",
   "address": "Event Address"
 }
}

In this example, the organizer property of the Event type is referring to the previously defined Organization by using its @id. This tells search engines that the organizer of the event is the same entity that’s defined in the #organization @id.

Specifying the @type when using @id is not always mandatory, as JSON-LD can infer the type from the context and previous definitions. However, it’s a good practice for clarity, especially in complex or flexible contexts, to explicitly state the type when referring to entities. It helps make the document more self-descriptive and understandable, and it’s particularly useful when working with linked data from diverse sources.

How to Choose @id for Schema

Choosing an @id for your Schema markup is an important part of creating structured data for your website. Follow these guidelines to help you choose the right @id:

1. Understand the hierarchy

Before choosing the @id, it’s important to have a clear understanding of the hierarchy of your website. 

You may have a parent entity with an @id, and child entities can reference the parent entity’s @id to establish relationships. Recognizing these relationships is vital for creating a web of linked data.

This can vary based on your industry or business type, but in general, your website can be broken down into categories, subcategories, and individual pages. The @id attribute helps to define the relationship between these different levels, so it’s crucial to get it right.

2. Choose a unique identifier

Your @id should be unique across your entire website. In other words, it shouldn’t be used more than once. This makes it easier for search engines to identify and index the different entities on your website. Typically, the @id can be a string of alphanumeric characters, such as a product code or SKU.

3. Use a Clear and Descriptive IRI

The IRI you choose should be clear and descriptive. It should ideally reflect the name or nature of the entity you’re defining. For example, if you’re defining an organization, an IRI like http://example.com/#organization is more descriptive than a generic IRI.

Some SEO experts recommend using URL format for the @id, especially for entities that have a dedicated page on the website. For example, if John’s Bakery has its own page at “www.john-bakery.com”, you could use “@id”: “www.john-bakery.com#organization”. This can help search engines understand the structure of your website better.

4. Keep it Simple

Avoid using overly complex codes or meaningless strings of characters that are difficult to understand. Instead, opt for a simple, descriptive @id that gives search engines a clear idea of what the entity represents on your site.

While JSON-LD syntax allows for special characters in @id, it’s a good practice to avoid them to prevent potential complications or errors.

5. Be consistent

When choosing your @id, try to maintain consistency across your website. This means using the same @id format for similar entities or pages. For example, if you’re identifying a product on one page using the @id “product123,” use a similar format for other products as well, such as “product345” and “product678.”

6. Test and validate

Once you’ve chosen your @id, it’s essential to test and validate your schema to ensure that it doesn’t conflict with any existing entities on the web or in your dataset. There are online tools, such as Rich Results Test or Schema Validator Tool,, available for checking whether your markup is correctly formatted and free of errors. 

If there are any issues with your markup, the tool will highlight them, giving you an opportunity to fix them before publishing your site.

Conclusion

Choosing the right @id for your schema entities is a fundamental step in creating clear, meaningful, and interconnected data. The perfect @id is not just a string; it’s an identifier that empowers your data to speak a universal language, linking your content with the broader web of data.

Aubrey Yung

Aubrey Yung

Aubrey is an SEO Consultant with 5+ years of B2B and B2C marketing experience.