     [Answers](https://scrapfly.io/blog)   /  [beautifulsoup](https://scrapfly.io/blog/tag/beautifulsoup)   /  [How to find HTML element by class with BeautifulSoup?](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-class-with-beautifulsoup)   # How to find HTML element by class with BeautifulSoup?

 by [Bernardas Alisauskas](https://scrapfly.io/blog/author/bernardas) Apr 13, 2026 1 min read [\#beautifulsoup](https://scrapfly.io/blog/tag/beautifulsoup) [\#css-selectors](https://scrapfly.io/blog/tag/css-selectors) [\#data-parsing](https://scrapfly.io/blog/tag/data-parsing) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-html-elements-by-class-with-beautifulsoup "Share on LinkedIn")    

 

 

Using Python and BeautifulSoup, to find elements by class name we can either use `find` and `find_all` functions with the `class_` parameter or [CSS selectors](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-class):

python```python
import bs4
soup = bs4.BeautifulSoup('<a class="social-link">some link</a>')

# using find() and find_all() methods:
soup.find("a", class_="social-link")  # alternatively find_all can be used to find all
soup.find("a", {"class": "social-link"})
# to find by partial class name we can use regex:
import re
soup.find("a", class_=re.compile("link", re.I))  # tip: re.I parameter makes this case insensitive

# using css selectors via select() and select_one() methods
soup.select('.social-link')
# to find by partial class name we can use `*=` matcher:
soup.select('[class*="link"]') 
# or
soup.select('[class*="link" i]')  # "i" addition makes this case insensitive
```





 

    



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-html-elements-by-class-with-beautifulsoup) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-html-elements-by-class-with-beautifulsoup) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-html-elements-by-class-with-beautifulsoup) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-html-elements-by-class-with-beautifulsoup) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-find-html-elements-by-class-with-beautifulsoup) 



 ## Related Articles

 [  

 python data-parsing 

### How to Parse Web Data with Python and Beautifulsoup

Beautifulsoup is one the most popular libraries in web scraping. In this tutorial, we'll take a hand-on overview of how ...

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-python-beautifulsoup) [  

 blocking nodejs 

### Web Scraping With Node-Unblocker

Tutorial on using Node-Unblocker - a nodejs library - to avoid blocking while web scraping and using it to optimize web ...

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-node-unblocker) [  

 http nodejs 

### Web Scraping With NodeJS and Javascript

In this article we'll take a look at scraping using Javascript through NodeJS. We'll cover common web scraping libraries...

 

 ](https://scrapfly.io/blog/posts/web-scraping-with-nodejs) 

  ## Related Questions

- [ Q How to find HTML elements by attribute using BeautifulSoup? ](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-attribute-with-beautifulsoup)
- [ Q How to find HTML elements by class? ](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-class)
- [ Q How to get the name of an HTML element in XPath? ](https://scrapfly.io/blog/answers/how-to-get-name-of-selected-element-in-xpath)
- [ Q How to find HTML elements by multiple tags with BeautifulSoup? ](https://scrapfly.io/blog/answers/how-to-find-html-elements-by-multiple-tags-with-beautifulsoup)
 
  



   



 Extract structured data with AI, **1,000 free credits** [Start Free](https://scrapfly.io/register)