24 Hours Only: Get 39% OFF on Our Premium Plan - Check Out Now!
Every YouTube video has a unique ID.

It's up in the URL: a string of eleven characters

that uniquely identifies which video you want.

Now, YouTube has millions and millions of videos.

The last stats that they released said they have

400 hours of video being uploaded every minute.

So: are they ever going to run out of those IDs?

Well, to find out, let's talk about counting systems.

People count in Base 10. 0 to 9.

That'll be, hopefully, familiar to you.

Computers count in base 2, in binary,

but that's difficult for humans to read,

it gets too long to write really, really quickly,

so often computers will display it in base 16, hexadecimal.

You have 0 to 9, and then A to F,

and then you start adding to the next column.

Humans can't understand that easily,

but it's efficient if we have to type it in somewhere,

and 16 - 2 to the power of 4 - is also easy for computers to deal with.

So how about Base 64?

That'd be a ridiculous counting system, right? Except.

64 is another one of those easy numbers for computers,

it is 2 to the power of 6.

And humans can get to 64 very easily:

0 to 9, then capital letters A to Z,

then small letters a to z, and two other characters.

Most Base 64 uses slash and plus,

but they don't work so well in URLs,

so YouTube uses hyphen and underscore.

That YouTube URL, that unique ID,

is really just a random number in base 64.

They could have have picked base 10 or base 16,

but they didn't: they went with 64,

because it will let you cram a huge number into a small space

and still make it vaguely human readable.

Author and programmer Sam Hughes, by the way,

pushed this to the limit, and invented Base 65,536,

which includes basically every character from every language.

It is ridiculous and unnecessary,

but when has that ever stopped programmers?

So why didn't YouTube just start counting at 1 and work up?

Well, first, they would have to synchronise their counting

between all the servers handling the video uploads,

or they'd have to assign each server a block of numbers.

Either way, there's a lot of tracking to do,

a lot of making sure that it's never duplicated.

Instead, they just generate a random number for each video,

see if it's already taken, and if not, use it.

And secondly, it is a really, really bad idea

to just count 1, 2, 3 and so on in URLs.

Incremental counters, as they're called, can be a big security flaw:

if you see video 283 up there, then you might wonder:

what's video 284? Or video 282?

It's easy to enumerate, as it's called,

to run through the entire list.

YouTube Unlisted videos, the ones that don't appear publicly

but that you can send the link to people, those wouldn't work.

And by the way? Lots of badly designed sites do use incremental counters.

And it is a terrible idea.

It might tell your competitors exactly how many customers you have,

'cos they can just count them.

It might let people download all your records easily,

'cos they can just run through them.

And in one site that someone in Florida emailed me about this week,

it lets you look at other people's personal details.

Don't use incremental counters if you're building a web site. Use a random number.

Which brings me to the question:

just how big are the numbers that YouTube uses?

Well, let's work it out.

One character of base 64 lets you have 64 ID numbers.

Two characters? That's 64 by 64, or 4,096.

Three characters? 64 times 64 times 64 -- or 64 to the power of 3.

That is already more than a quarter of a million.

And if we go to four? Well, now we're above 16 million.

If you use Base 64, then you can assign an ID number

to everyone who lives in London down there twice over,

and you'll only need four characters.

This gets big fast. We can keep on doing this,

and by seven characters we're already at four quadrillion.

Now, I assume that YouTube checks through a dictionary,

and doesn't allow any actual words to appear up there --

particularly anything rude.

But that is going to be a tiny minority of the URLs,

so for our purposes, we can pretty much just ignore that.

At YouTube's 11 characters, we are at 73 quintillion 786 quadrillion

976 trillion 294 billion 838 million

206 thousand and 464 videos.

That's enough for every single human on planet Earth

to upload a video every minute for around 18,000 years.

YouTube planned ahead.

Can they run out of URLs? Technically, yes.

Practically? No. And if they did?

They could just add one more character.

[Translating these subtitles? Add your name here!]

Ha! One take! One take! Yes!

Please play the YouTube video first

Will YouTube Ever Run Out Of Video IDs?


Leave a Reply

Your email address will not be published. Required fields are marked *

We have detected unusual activity on your device.
Please verify your identity to continue.
Note: This verification step won't sign you in. If you have a premium account, please log in to access the service as usual.
Google/Gmail Verification
Or verify using Email/Code
We've sent a verification code to:
youremail@gmail.com (Not your email?)
Enter it below to complete the verification process.
Ensure your email address is correct, your inbox is not full, and you check your spam folder. If no email arrives, consider using an alternative email.
You will need a Premium plan to perform your action!
Note: If you already have a premium account, please log in to access our services as usual.

Plans & Pricing

Our mission is to make quality education accessible and free for everyone.
However, to keep our hardworking team running and this service alive, we genuinely need your support!
By opting for a premium plan, not only do you sustain us in achieving the mission, but you also unlock advanced features to enrich your learning experience.

Free

For learners who aren't pressed for time

What's included on Free
1000+ IELTS Tests & Samples
Instant IELTS Writing Task 1 & 2 Evaluation (2 times/month)
Instant IELTS Speaking Part 1, 2, & 3 Evaluation (5 times/month)
Instant IELTS Writing Task 1 & 2 Essay Generator (2 times/month)
500+ Dictation & Shadowing Exercises
100+ Pronunciation Exercises
Flashcards
Other Advanced Tools

Premium

For those serious about advancing their English proficiency, and for IELTS candidates aspiring to boost their band score by 1-2 points (especially in writing & speaking) in just 30 days or less

What's included on Premium
Save Your IELTS Test Progress
Unlock All Courses & Content
Unlimited AI Conversations
Unlimited AI Writing Enhancement Exercises
Unlimited IELTS Writing Task 1 & 2 Evaluation
Unlimited IELTS Speaking Part 1, 2, & 3 Evaluation
Checked Answers Will Not Be Published
Unlimited IELTS Writing Task 1 & 2 Essay Generator
Unlimited IELTS Speaking Part 1, 2, & 3 Sample Generator
Unlimited Usage Of Advanced Tools

Due to the nature of our service and the provided free trials, payments are non-refundable.
Nếu bạn là người Việt Nam và không có hoặc không muốn trả bằng credit/debit cards, bạn có thể thanh toán bằng phương thức chuyển khoản:



Chọn gói:
279,000₫ 157,000 ₫ cho gói 1 tháng (chỉ 5,233₫/ngày)
819,000₫ 397,000 ₫ cho gói 3 tháng (chỉ 4,411₫/ngày)
1,649,000₫ 667,000 ₫ cho gói 6 tháng (chỉ 3,706₫/ngày)
3,299,000₫ 857,000 ₫ cho gói 12 tháng (chỉ 2,381₫/ngày)


Sau khi chuyển khoản, vui lòng đợi trình duyệt tự động điều hướng bạn trở lại Engnovate và bạn sẽ ngay lập tức nhận được mã kích hoạt tài khoản premium.
Nếu có lỗi xảy ra, bạn có thể liên hệ với team thông qua một trong các phương thức: email đến helloengnovate@gmail.com hoặc nhắn tin qua facebook.com/engnovate.
Vì toàn bộ công cụ trên website đều có thể sử dụng thử miễn phí, Engnovate không hỗ trợ hoàn tiền.