Web Developer interview questions and sample answers

A web developer interview usually mixes two kinds of question: ones that test whether you know the job, and behavioral ones that ask for proof from your past. Below are 10 of the first with a short model answer, and 5 of the second with what the interviewer is really checking. Rewrite every answer in your own words and with your own numbers.

Job-specific questions

1. How do you approach making a website responsive across devices?

I use a mobile-first CSS approach with flexible grid layouts and breakpoints at common widths like 768px and 1024px, and test on real devices, not just browser dev tools, since touch targets and font rendering can differ.

2. Walk me through how you would improve a slow-loading webpage.

I run it through Lighthouse first to find the bottleneck, usually unoptimized images or render-blocking JavaScript. I compress images to WebP, lazy-load below-the-fold content, and defer non-critical scripts, cutting load time by 40 to 60 percent.

3. How do you handle cross-browser compatibility issues?

I check caniuse.com before using a newer CSS or JS feature, test in Chrome, Firefox, and Safari at minimum, and use a tool like Autoprefixer to handle vendor prefixes automatically rather than manually patching each browser's quirks.

4. Describe your approach to writing accessible HTML.

I use semantic elements like nav, main, and button instead of generic divs, add alt text to every meaningful image, and ensure the whole site is keyboard-navigable, testing with just Tab and Enter before shipping anything.

5. How do you secure a web application against common vulnerabilities?

I sanitize and parameterize all database queries to prevent SQL injection, escape user input to prevent XSS, and enforce HTTPS with proper CSP headers. I also keep dependencies updated since many vulnerabilities come from outdated packages.

6. What is your process for debugging a JavaScript error in production?

I check the browser console and an error monitoring tool like Sentry first for the stack trace, reproduce it in staging with the same data if possible, and add logging or breakpoints to isolate exactly where the state goes wrong.

7. How do you decide between a REST API and GraphQL for a project?

For a simple CRUD app with predictable data needs, I use REST since it's simpler to cache and debug. For a client that needs flexible, nested data, like a dashboard pulling from multiple resources, GraphQL avoids REST's over-fetching.

8. Tell me about a bug that was hard to reproduce and how you found it.

A form was silently failing only for users on Safari with autofill enabled. I couldn't reproduce it in Chrome, so I tested directly in Safari, found autofill was triggering a validation event before onChange fired, and fixed the event order.

9. How do you approach SEO considerations as a developer?

I make sure pages server-render or pre-render critical content so crawlers can index it, use semantic heading structure, set descriptive meta tags and alt text, and keep page load under 3 seconds since Core Web Vitals affect ranking directly.

10. How do you manage state in a complex frontend application?

I keep local component state for UI-only concerns, like a dropdown being open, and use a global store like Redux or Context only for data shared across many components, since over-using global state makes debugging harder than needed.

Behavioral questions

Answer these with STAR: the Situation in one sentence, the Task, the Action you took (most of the answer), the Result with a number.

11. Tell me about a result you are proud of.

What they are checking: A specific outcome with a number, and what you personally did to get it.

A result to build the answer around: Raised Lighthouse performance from 54 to 94 on the main store, lifting mobile conversion by 12%.

12. Describe a time you improved how something was done.

What they are checking: That you notice waste and fix it without being told, then measure the difference.

A result to build the answer around: Shipped 20+ client sites in React and TypeScript on schedule.

13. Tell me about a time you had to deliver under pressure.

What they are checking: How you prioritise, communicate early and still finish to standard.

A result to build the answer around: Brought the product to WCAG 2.1 AA, fixing 150+ accessibility issues.

14. Give an example of working with a difficult colleague or customer.

What they are checking: Calm, the other person's view stated fairly, and a result that helped both sides.

A result to build the answer around: Built a reusable component library that cut new-page build time by 40%.

15. What is something you learned from a mistake?

What they are checking: Ownership without excuses, and the habit you changed so it did not happen again.

A result to build the answer around: Reviewed pull requests for a team of 5 and reduced production bugs by 25%.

Before the interview

Interviewers read your resume just before they walk in, and most questions come from it. Every bullet on it should be one you can expand into a two-minute STAR story. Check that it matches the posting with the free ATS Match Score, and look at the web developer resume keywords the ad is likely to use.

Turn your notes into a web developer resume, free

No signup, no card. See the full web developer resume example and the cover letter example.

Interview questions for related jobs

All interview question lists · CV Forge — free resume generator