---
title: Underscore Instead of Dash in Hreflang
description: Follow these simple steps to change an underscore to a dash in your hreflang code so that your hreflang attribute isn't invalid.
---

[Knowledge Base - Resources - seoClarity ](https://www.seoclarity.net/resources/knowledgebase)

# [Underscore Instead of Dash in Hreflang](https://www.seoclarity.net/resources/knowledgebase/glossary/hreflang/underscore-instead-dash-hreflang)

 Written by [Suraj Lalchandani](https://www.seoclarity.net/resources/knowledgebase/author/suraj-lalchandani) | May 4, 2023

If your hreflang uses an underscore instead of dash, you can update the attribute to solve this issue.

Otherwise, the [hreflang attribute](https://www.seoclarity.net/resources/knowledgebase/glossary/hreflang) is invalid. Here’s how to do it.

#### Table of Contents

- - [Why to Avoid Underscores](https://www.seoclarity.net/resources/knowledgebase/glossary/hreflang/underscore-instead-dash-hreflang?hs_amp=true#why-avoid-underscores)
    - [How to Switch from an Underscore to a Dash](https://www.seoclarity.net/resources/knowledgebase/glossary/hreflang/underscore-instead-dash-hreflang?hs_amp=true#how-switch-underscore-dash)
    - [Updating Hreflang at Scale](https://www.seoclarity.net/resources/knowledgebase/glossary/hreflang/underscore-instead-dash-hreflang?hs_amp=true#updating-hreflang-scale)
      
          - [Before and After](https://www.seoclarity.net/resources/knowledgebase/glossary/hreflang/underscore-instead-dash-hreflang?hs_amp=true#before-after)
    - [*Looking for other hreflang issues?*](https://www.seoclarity.net/resources/knowledgebase/glossary/hreflang/underscore-instead-dash-hreflang?hs_amp=true#looking-other-hreflang-issues)

## Why to Avoid Underscores

Google’s [specifications for hreflang](https://support.google.com/webmasters/answer/189077?hl=en) say the use of underscores (i.e. _) should not be used to separate the language and country. Instead a dash should be used (i.e. -)

For example, we would want to use “en-us” as opposed to “en_us”. 

## How to Switch from an Underscore to a Dash

A simple change of your hreflang code can change an underscore to a dash. This can be done if you have access to your site’s CMS and direct edit access. 

You can also put in a dev ticket. 

## Updating Hreflang at Scale

While a manual approach can get the job done, the project may land at the end of the dev team’s queue. Luckily, you can update your hreflang tags at scale with ClarityAutomate, an [SEO execution platform](https://www.seoclarity.net/seo-automation/).   

This allows you to update your hreflang with a few clicks and solve the issue in a matter of minutes. Plus, you can get the job done without involving the dev team. 

Here’s how to do it in a few steps.

1. **Select what you'd like to optimize: Code**  
   Since hreflang is a part of your site’s code, that’s what we’re looking to optimize in ClarityAutomate.
2. **Choose how you'd like to optimize it: Update**  
   This issue involves a change to the existing attribute (as opposed to an addition or deletion) so we select “Update”. 
3. **XPath location: XPath of the <link rel=alternate> with the issue**  
   Selecting the XPath location lets us narrow in on the specific issue.
4. **Attribute: hreflang**  
   The attribute we’re looking to update is hreflang, so we simply select that in this step.
5. **New Value: The new value of hreflang with a dash instead of underscore separating the language and country**  
   As a last step, we can specify our change and replace those underscores with dashes. 

## Before and After

Notice how “en_us” has been updated to “en-us” after just a few steps with [ClarityAutomate](https://www.seoclarity.net/seo-automation/).

 

#### Looking for other hreflang issues?

- [Conflicting Hreflang and rel=canonical](https://www.seoclarity.net/resources/knowledgebase/conflicting-hreflang-and-canonical) 
- [Hreflang with multiple defaults](https://www.seoclarity.net/resources/knowledgebase/hreflang-with-multiple-defaults) 
- [Invalid region in the Hreflang attribute](https://www.seoclarity.net/resources/knowledgebase/invalid-region-hreflang-attribute) 
- [Invalid language in the Hreflang attribute](https://www.seoclarity.net/resources/knowledgebase/invalid-language-hreflang-attribute) 
- [Hreflang with Duplicate Language/Region Combinations](https://www.seoclarity.net/resources/knowledgebase/hreflang-with-duplicate-language/region-combinations) 
- [Hreflang Missing Language Entry](https://www.seoclarity.net/resources/knowledgebase/hreflang-missing-language-entry) 
- [Empty Hreflang URL](https://www.seoclarity.net/resources/knowledgebase/empty-hreflang-url) 
- [Hreflang Not Present](https://www.seoclarity.net/resources/knowledgebase/hreflang-not-present) 
- [Hreflang Present Outside <head>](https://www.seoclarity.net/resources/knowledgebase/hreflang-present-outside) 
- [Hreflang URL Is Invalid](https://www.seoclarity.net/resources/knowledgebase/hreflang-url-invalid) 
- [Invalid order of Hreflang values](https://www.seoclarity.net/resources/knowledgebase/invalid-order-hreflang-values) 
- [No self-referencing Hreflang tag](https://www.seoclarity.net/resources/knowledgebase/no-self-referencing-hreflang-tag) 
- [Hreflang Using Relative links](https://www.seoclarity.net/resources/knowledgebase/hreflang-using-relative-links) 

[View full post](https://www.seoclarity.net/resources/knowledgebase/glossary/hreflang/underscore-instead-dash-hreflang)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Suraj Lalchandani"
  },
  "dateModified" : "2023-05-24T16:39:39.131Z",
  "datePublished" : "2023-05-04T21:24:35Z",
  "headline" : "Underscore Instead of Dash in Hreflang",
  "image" : {
    "@type" : "ImageObject",
    "height" : 601,
    "url" : "https://www.seoclarity.net/hubfs/page_hreflang_14_underscoreinsteadofdashinhreflang.png",
    "width" : 1201
  },
  "mainEntityOfPage" : "https://www.seoclarity.net/resources/knowledgebase/glossary/hreflang/underscore-instead-dash-hreflang",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "Knowledge Base"
  }
}
```