How to Get YouTube Channel Subscriber Count without Using API

YouTube provides these subscribe buttons which include the number of your channel subscribers which can be extracted using a simple regular expression.

Extract the Subscribe Count in PHP


// Change channelid value to match your YouTube channel ID
$url = '';

// Fetch the Subscribe button HTML
$button_html = file_get_contents( $url );

// Extract the subscriber count
$found_subscribers = preg_match( '/="0">(\d+)</i', $button_html, $matches );

if ( $found_subscribers && isset( $matches[1] ) ) {
    echo intval( $matches[1] );

The Channel ID can be found on your YouTube profile page.


Here is the number of subscribers of my YouTube channel.

Never lose a single business lead or enquiry again! Get my latest plugin Storage for Contact Form 7 now!

Buy now for only $19 →


  1. Sangeetha says:

    The above code is not working for the youtube channels, whose subscriber count has letters. E.g.100K. Can you please post the code for handling that?

Leave a Reply