Black-box, grey-box and white-box testing describe how much a security tester is told before a test.
This guide is for anyone who is buying, planning or reading about a security test, and for students new to the field. You do not need to be technical: if your business pays for a test, choosing the box type changes what you get for your money.
In short
- Black box: the tester is told almost nothing, like an outside attacker.
- Grey box: the tester gets some help, such as a normal user account.
- White box: the tester gets full details, which can include the code and designs.
- More information usually means more weak spots found in the same time. Less information shows what a stranger could find.
What you will learn
- Explain the three box types in one sentence each.
- Spot which box type a test proposal describes.
- Explain why a black-box test can miss weak spots.
- Ask a tester which type fits your goal and budget.
- Allowed test attack (penetration test)
- a test where a hired expert tries to break in, with permission, to find weak spots.
- Inside details (internal knowledge)
- facts about how a system is built, such as its code, designs or accounts.
- What is covered (scope)
- the list of systems the tester is allowed to test.
What are black-box, grey-box and white-box testing?
Think of a home safety inspector. You could give them just your address. You could hand them a door key. Or you could give them the full building plans and walk them round.
Each choice gives a different inspection. With only the address, they see what a passer-by sees. With the plans, they can check the wiring behind the walls.
Security testing works the same way. A penetration test (an allowed test attack) can be run with three levels of inside details.
- Black box: the tester assumes no knowledge of how the system works inside.[2] They start from the outside, like a stranger.
- Grey box: the tester has some knowledge, such as a user account or a short description of the system.[3]
- White box: the tester has full and detailed knowledge of how the system is built.[4] This can include the source code (the written instructions that make up a program).
The UK's National Cyber Security Centre uses the words "closed box" and "open box" for the two ends. In an open-box test, full information about the target is shared with the testers.[1] Other names you may see are clear box and glass box for white box.[4]
Where the comparison stops working: a home inspector is checking for accidents. A security tester acts like someone who wants to get in on purpose. So they try things an inspector would not.
Why does it matter?
The box type shapes what a test can find. UK government guidance notes that giving testers little information can leave weak spots undiscovered.[1] A clean black-box report does not mean the system has no weak spots.
If you are buying a test for your business
What could happen: you pay for a black-box test of a new app, and the short time is spent just finding the way in.
Check this: ask the tester which box type gives you the most value for your goal.
If you are a student or new to security
What could happen: you hear "black box" in a job advert or a course and are not sure what is meant.
Check this: ask what the tester was given at the start. That answer tells you the box type.
If you manage a development team
What could happen: your team keeps the code hidden from testers, so flaws inside the program are missed.
Check this: ask whether a grey-box or white-box test, or a code review, would check more.
What does it look like?
A test proposal often has a short section saying what the tester will be given. Here is a made-up one for a grey-box test of a booking website.
Example only. All values are made up.
TEST PROPOSAL: booking site, grey box Target: book.example.com (1) Tester will receive: - 2 customer test accounts (FAKE-user-01, FAKE-user-02) (2) - a one-page map of the main pages (3) Tester will NOT receive: source code, staff accounts (4) Time: 5 days (5)
- In a real file, this line would contain the address of the website the tester may test.
- Normal customer accounts, so the tester can check what a signed-in customer could reach.
- A short guide to the site, which saves the tester time.
- Details held back. Holding back the code is what makes this grey box, not white box.
- The time paid for. Less information means more of this time goes on finding the way in.
Why this is risky: nothing here is wrong, but a reader may assume the test checked everything. Anything only a staff member or the code could reveal was not tested.
The safer way: read the "will not receive" line and treat it as a list of what was not checked. Ask whether another test, or a code review, should cover those gaps.
How does it work?
Here is how the box type is usually chosen and used.
- Agree the goal. Do you want to know what a stranger could do, or find as many weak spots as possible?
- Agree what is covered. The NCSC suggests that scoping involves the risk owner, technical staff who know the system and the testing team.[1]
- Choose what to share. The NCSC notes that the amount of information shared can vary, even within one test.[1] Some teams also share an existing list of known weak spots.
- Run the test. In black box, the tester first explores to learn how the system works. In grey and white box, they can spend that time checking more parts.
- Read the report with the box type in mind. A finding is a finding. A missing finding may only mean the tester could not reach that part.

No type is best for every test. Black box shows what someone outside could find, but it can miss weak spots deeper inside.[1] White box can check more, including flaws in the code. OWASP, a well-known open security community, notes that reviewing source code can find problems that are very hard to find with a penetration test alone.[5] Grey box sits between the two, and is a common middle choice.

A worked example
Darius Novak runs a small online booking firm, a fictional company with eight staff. His new booking app goes live next month, and a large client has asked for a security test first.
Darius calls a testing firm. Their tester, Zola Iyer, asks him one question first. "What do you most want to find out?"
Darius thinks of the home inspector. He does not only want to know what a passer-by sees. He wants to know if a customer could see someone else's bookings.
Zola suggests a grey-box test. She will get two customer test accounts and a short map of the app. Hugo Kader, who built the app, agrees to answer her questions during the week.
"Could you do it black box instead?" Darius asks. Zola explains that she could. But with five days, much of her time would go on finding her way round the app. She might never reach the booking pages.
Darius signs off the grey-box plan, with the test accounts and dates in writing.
In the report, Zola lists a weak spot. A signed-in customer could change one number in a web address and see another customer's booking. A stranger with no account would not have reached that page.
Hugo fixes it, and Zola checks the fix. The report also says what was not tested: the source code and the staff pages. Darius notes both for next year's test.
Myths and mistakes
| What people think | What is true |
|---|---|
| Black box is the most realistic, so it is always best. | It shows a stranger's view, but it can miss weak spots deeper in.[1] Real attackers may also have stolen accounts or inside help. |
| Giving testers information is cheating. | It helps them use the paid time to check more of the system. |
| A clean black-box report means we are secure. | It means the tester did not find a way in during that test. A test checks a sample, not everything.[5] |
| White box means the tester reads the code and nothing else. | White-box testers can still test the running system. They just have the plans as well. |
| The box type does not matter once the test is booked. | It shapes what the report can tell you. Read the report with it in mind. |
What can I do this week?
- Find your last test report and check which box type it used.
- List what the testers were not given, and treat it as untested.
- Write down your main goal for the next test in one sentence.
- Ask your tester or supplier which box type fits that goal and why.
Checklist
- The goal of the test is written down before the box type is chosen.
- The proposal says clearly what the tester will and will not receive.
- Test accounts are made for the test and removed afterwards.
- Someone who knows the system is available to answer questions.
- The report states the box type and what was not tested.
- Gaps from one test are noted for the next test or a code review.
Common questions
Which box type is best for a first test?
Grey box is often a sensible start for a small business. The tester gets a normal account, so they can check what customers or staff could reach. It usually finds more than black box in the same time. Your tester can advise on what fits your goal.
Is grey box the same as gray box?
Yes. Grey is the British spelling and gray is the American spelling. Both mean a test where the tester has some inside details, such as a user account, but not everything. You may also see it called a focused test.
Is a black-box test cheaper?
Not always. Price usually depends on the number of days. With fewer details, the tester spends more of those days just learning the system. So for the same price, a black-box test may check less of it.
Does white-box testing mean sharing our code?
Often, yes. A white-box test can include the source code, designs and help from the builders. Share it the way you would share any sensitive file: under a contract, through a safe channel, and only for the length of the test.
Can one test mix box types?
Yes. The NCSC notes that the information shared can vary within one test. For example, a tester might start black box from the internet, then get an account to test what a signed-in customer could reach.
Where next?
Ready for the detail? Read the practitioner guide: Black Box vs Grey Box vs White Box Testing. It goes further into when realism beats coverage, how to handle test accounts and how to measure whether the choice worked.
Also useful:
- Penetration Testing for Beginners
- Buying a Penetration Test for Beginners
- Penetration Test Reports for Beginners
- Secure Code Review for Beginners
- Assumed Breach Testing Guide
Related NHI Mgmt Group resources: Red Teaming for Beginners · Test and Synthetic Accounts Governance Guide · Bug Bounty vs Penetration Testing
Key terms
- Penetration testing
- An allowed test attack that tries to find weak spots the way a real attacker would.
- Black box testing
- Testing where the tester has no inside details and can only see what an outsider sees.
- Grey box testing
- Testing where the tester has some inside details, such as an account or notes, but not the full code.
- White box testing
- Testing where the tester has full details, which can include the code and designs.
- Scope
- The boundary of what a test covers, such as which systems and which dates.
- Source code review
- Reading a program's code to find security weak spots that testing from outside may miss.
Sources and further reading
- Penetration testing. National Cyber Security Centre (NCSC), UK. https://www.ncsc.gov.uk/guidance/penetration-testing, accessed 28 Nov 2026.
- Glossary: black box testing (from NIST SP 800-53A Rev. 5 and SP 800-192). NIST Computer Security Resource Center. https://csrc.nist.gov/glossary/term/black_box_testing, accessed 28 Nov 2026.
- Glossary: gray box testing (from CNSSI 4009-2022 and NIST SP 800-53A Rev. 5). NIST Computer Security Resource Center. https://csrc.nist.gov/glossary/term/gray_box_testing, accessed 28 Nov 2026.
- Glossary: white box testing (from NIST SP 800-137 and SP 800-192). NIST Computer Security Resource Center. https://csrc.nist.gov/glossary/term/white_box_testing, accessed 28 Nov 2026.
- Web Security Testing Guide v4.2, Introduction. OWASP Foundation. https://wstg.owasp.org/v4.2/2-Introduction/, accessed 28 Nov 2026.