← Growth Center

How to Add Review Schema Markup to HTML for Rich Snippets

Learn exactly how to add review schema markup to HTML. Get the code templates, follow Google's strict guidelines, and earn star ratings in search results.

By Forge Growth Research9 min read

To know exactly how to add review schema markup to HTML, you must generate a block of structured data code—preferably in JSON-LD format—and paste it into the <head> or <body> of your webpage. This code translates your visible customer reviews into a standardized format that search engines understand. By doing this, you allow search engines to extract your ratings and display gold star rich snippets directly under your links in the search results.

Key Takeaways

  • JSON-LD is Google's recommended format for schema markup because it is isolated from your visible HTML structure.
  • You cannot use review schema to display self-serving reviews on your own LocalBusiness or Organization homepage.
  • Review schema requires specific properties like the reviewer's name, the item reviewed, and a valid rating value.
  • Adding structured data directly helps AI search engines like Perplexity and ChatGPT extract and cite your business ratings.
  • Always test your review schema using Google's Rich Results Test before publishing the code to your live website.

Adding this markup is a fundamental part of technical SEO. It does not just make your search results look better; it actively drives higher click-through rates. In this guide, we will break down the exact code you need, where to put it, and the strict rules you must follow to avoid Google penalties.

Why Learning How to Add Review Schema Markup to HTML Matters

Search engine results pages (SERPs) are incredibly crowded. You are competing against paid ads, local map packs, AI overviews, and ten other organic links. Standing out is no longer optional.

When you add review schema markup to your HTML, you give your search result a visual advantage. A standard search result contains a blue link and a short text description. A rich snippet result contains the blue link, the description, and a bright row of gold stars, alongside the total number of reviews and the average rating.

Data consistently shows that pages with star ratings get significantly higher click-through rates (CTR). A search result sitting in the number three spot with gold stars will frequently steal clicks from the number two or number one spot that lacks them. This happens because the stars instantly communicate trust and social proof before the user even visits your site.

Beyond traditional Google searches, structured data is vital for artificial intelligence. Large language models (LLMs) and AI search engines rely heavily on clean code to pull facts about your business. When users ask ChatGPT or Perplexity, "Who is the highest-rated service provider near me?", the AI scans the web. If your site uses clean JSON-LD schema, the AI can parse your ratings in milliseconds. If your site relies on messy, unstructured HTML tables, the AI will likely skip you. Learning how to rank on Perplexity for local searches starts with giving the AI data it can easily read.

Google's Strict Guidelines for Review Snippets

Before you write a single line of code, you must understand Google's rules. Search engines are highly protective of review snippets because fake reviews ruin the user experience. If you try to manipulate review schema, Google will issue a manual action penalty, removing your site from rich results entirely.

In 2019, Google updated its guidelines to ban "self-serving" reviews. You cannot add review schema to your own website's homepage to mark up your own LocalBusiness or Organization entity using reviews you collected yourself. If you own a plumbing company, you cannot put five-star schema on your homepage that says "Our plumbing company is rated 5 stars."

So, how do local businesses use review schema?

You can mark up specific products, specific services, or distinct events. For example, if you run a restaurant, you cannot put review schema on your main homepage. However, if you are learning how to market private event space for restaurants, you can absolutely add review schema to your dedicated "Private Dining Room" landing page, provided the reviews are specifically about that room and are visible on the page.

According to Google Search Central's Review Snippet Guidelines, you must also ensure:

  • The reviews are visible to the user on the page.
  • The markup refers to a specific product or service, not a general category.
  • The reviews are written by actual customers, not your staff.

JSON-LD vs. Microdata: Choosing Your Format

There are three ways to write schema markup: JSON-LD, Microdata, and RDFa. Today, the choice is simple: you should always use JSON-LD.

Microdata and RDFa require you to wrap your visible HTML text in specific schema tags. This is dangerous because anytime you redesign your website or change a sentence, you risk breaking your schema code. JSON-LD, on the other hand, is a self-contained block of Javascript that sits hidden in the background of your page. It is completely isolated from your site's visual design.

Here is a clear look at why JSON-LD is the undisputed industry standard:

FeatureJSON-LD (Recommended)Microdata (Outdated)
Google PreferenceExplicitly recommended by GoogleSupported, but not preferred
Code PlacementClean script tag in <head> or <body>Intertwined with visible HTML tags
MaintenanceVery easy to update without breaking layoutHigh risk of breaking design during updates
Dynamic InjectionCan be deployed via Google Tag ManagerMust be hard-coded into page templates

We will exclusively use JSON-LD for the remainder of this guide, as it is the most reliable method for how to add review schema markup to HTML.

The Anatomy of Review Schema Code (With Templates)

There are two main types of review markup you will use: Review (for a single review from one person) and AggregateRating (for the average score of many reviews).

Template 1: Single Review Schema

Use this code when you want to highlight one specific, glowing review from a customer for a specific product or service.

`json

{

"@context": "https://schema.org/",

"@type": "Review",

"itemReviewed": {

"@type": "Product",

"name": "Premium Exterior House Painting"

},

"author": {

"@type": "Person",

"name": "John Smith"

},

"reviewRating": {

"@type": "Rating",

"ratingValue": "5",

"bestRating": "5",

"worstRating": "1"

},

"reviewBody": "The team did an incredible job painting the exterior of our home. They were on time and very professional.",

"datePublished": "2025-01-15"

}

`

Line-by-Line Breakdown:

  • @context and @type: These tell search engines that the following code uses the Schema.org vocabulary and that the object is a Review.
  • itemReviewed: This defines what is being reviewed. In local services, treat your specific service packages as "Products".
  • author: You must include the name of the person who left the review.
  • reviewRating: This tells the search engine the score. Always define bestRating (usually 5) and worstRating (usually 1) so search engines don't misinterpret your scale.

Template 2: Aggregate Rating Schema

This is the code that generates the most powerful rich snippets. It shows the average rating and the total volume of reviews. Use this on specific product pages or service pages where you display multiple reviews.

`json

{

"@context": "https://schema.org/",

"@type": "Product",

"name": "Premium Exterior House Painting",

"description": "Complete exterior painting service for residential homes.",

"aggregateRating": {

"@type": "AggregateRating",

"ratingValue": "4.8",

"reviewCount": "112",

"bestRating": "5",

"worstRating": "1"

}

}

`

Line-by-Line Breakdown:

  • Notice that the main @type here is Product. You attach the aggregateRating property inside the product you are describing.
  • ratingValue: The mathematical average of your reviews.
  • reviewCount: The total number of reviews.

Step-by-Step: Injecting the Code into Your Website

Once you have customized the JSON-LD templates with your actual customer data, you need to put the code on your website. The exact process depends on how your website is built.

For Static HTML Websites

If you hand-code your website, simply copy your JSON-LD block and wrap it in a script tag like this:

<script type="application/ld+json">

[PASTE YOUR JSON CODE HERE]

</script>

Paste this entire block into the <head> section of the specific HTML file for that service. If you cannot access the head section, placing it near the bottom of the <body> will also work, though the head is preferred for faster crawling.

For WordPress Websites

If you use WordPress, do not try to paste script tags directly into the visual text editor; WordPress will strip the code. Instead, use an SEO plugin like RankMath or Yoast, which have built-in schema generators.

Alternatively, you can use a plugin like "WPCode - Insert Headers and Footers". This allows you to paste the raw JSON-LD script into the header of specific pages. For example, if you are following a house painting company Google Business Profile setup guide, you will want your local landing pages to perfectly mirror the services listed in your profile. You would use WPCode to inject the AggregateRating script only on the specific landing page for "Exterior Painting", not globally across the whole site.

For Google Tag Manager

Advanced marketers use Google Tag Manager (GTM) to inject schema. You can create a new "Custom HTML" tag, paste your script block, and set a trigger for the tag to fire only on the specific URL of the service being reviewed. This keeps your actual website code completely clean and allows you to manage all schema markup from a single dashboard.

Testing and Validating Your Structured Data

Never guess if your code works. A single missing comma in a JSON-LD block will break the entire script, and search engines will ignore it entirely. Before you publish your new HTML to your live server, you must test it.

First, use the Google Rich Results Test. You can paste your raw code or input your live URL. This tool will tell you definitively if your page is eligible for review snippets. If there are errors (marked in red), you must fix them. If there are warnings (marked in yellow), it means you are missing optional properties, but the snippet can still function.

Second, run your URL through the Schema.org Validator. While Google's tool tests for rich snippet eligibility, the Schema validator tests for strict adherence to the global Schema vocabulary. Passing both tests ensures your code is bulletproof across all search engines and AI platforms.

Your Schema Deployment Checklist

If you want to know how to add review schema markup to HTML successfully on your first try, follow this exact checklist today:

  • [ ] Identify a specific product or service landing page (do not use your homepage).
  • [ ] Verify that the reviews you want to mark up are visually readable by a user on that exact page.
  • [ ] Choose between Single Review schema or Aggregate Rating schema.
  • [ ] Customize the JSON-LD template with your real rating, review count, and service name.
  • [ ] Wrap the JSON-LD in a <script type="application/ld+json"> tag.
  • [ ] Paste the code snippet into the Google Rich Results Test to check for syntax errors.
  • [ ] Inject the code into the <head> of your webpage via your CMS, raw HTML, or Google Tag Manager.
  • [ ] Re-test the live URL to confirm the search engines can read the published code.

Getting technical SEO right is complex, but it fundamentally changes how search engines and AI view your business. If you want to stop guessing and start dominating your local market, get your free Growth Plan at Forge Growth today by visiting our blueprint.

Common questions

Quick answers about this topic

Short answers first, then the detail. Skim what you need.

Can I write my own reviews for schema markup?

No, you cannot write your own reviews or use self-serving reviews for your local business schema.

Google strictly penalizes sites that mark up reviews they control for their own LocalBusiness or Organization entity. You must use authentic third-party reviews or mark up specific independent products instead.

LocalBusinessOrganization

Where exactly do I paste the schema markup in my HTML?

You should paste your JSON-LD schema markup inside the `<head>` section of your HTML document.

While Google can also read JSON-LD placed in the `<body>` of your page, placing it in the head keeps your code organized and ensures it loads quickly for search engine crawlers.

schema markupJSON-LDHTMLWhile Google

How long does it take for review stars to show up in Google?

It typically takes two to four weeks for review stars to appear in search results after you add the markup.

Google must recrawl your page, process the structured data, and determine if your site is trustworthy enough to display the rich snippet.

structured data

Does review schema markup guarantee star ratings in search?

No, adding review schema markup does not guarantee that Google will display star ratings for your page.

Search engines treat schema as a suggestion. If your site lacks authority, or if the markup violates strict guidelines, Google will hide the rich snippet.

schema markupGoogle

What is the difference between Review and AggregateRating schema?

A Review schema is used to mark up a single, specific review from one customer.

An AggregateRating schema calculates the average score and total number of reviews across multiple customers for a single product or service. Both formats can successfully trigger star ratings in search.

ReviewAggregateRating

Can I use microdata instead of JSON-LD for schema?

You can use microdata, but JSON-LD is heavily preferred by Google and the SEO industry.

JSON-LD keeps the structured data separate from your visual HTML, making it much easier to edit and less prone to breaking when you update your website's design or text.

structured dataGoogleSEOHTML
Take it further

Ready to see this in the wild?

Doing your homework? Compare providers

Want us to build this for you?

Forge Growth builds and manages websites, SEO, and lead systems for local businesses.

Operating company · Not an agency

We don't sell growth. We do it — then install it.

ForgeGrowth owns and operates real businesses. Every system we install into a client business was tested on our own P&L first.

  1. 01
    We launch businesses
  2. 02
    We grow them
  3. 03
    We learn what actually works
  4. 04
    We package those systems
  5. 05
    We install them into yours
4
Businesses we own
+70.8%
Revenue lift (Broken Bow)
180+
Direct bookings driven
$20,399
Net new revenue