Web developer interview questions.

Web developer interviews test the platform underneath every framework: how the browser turns HTML and CSS into a page, how the DOM and events work, and what happens on the network between a click and a response. These questions cover HTML and CSS basics, DOM work in plain JavaScript, and browser, networking and performance problems.

12 of these questions have free answers; the rest are in Pro. Updated .

189

questions

Easy
125
Medium
64

What interviewers look for

  • You can explain what happens between typing a URL and seeing the page.
  • You work with the DOM and events directly, without a framework.
  • You know how HTTP caching, cookies, storage and CORS affect a real app.
  • You can find and fix a slow page: large assets, render-blocking resources and layout shifts.

Concept questions, answered

The definitions and comparisons interviewers open with. Free to read, each with a full answer and examples.

What happens when you type a URL into the browser?

The browser parses the URL, finds the server's IP address through DNS, opens a TCP and TLS connection (or QUIC for HTTP/3), sends an HTTP request, receives HTML, parses it into the DOM, fetches CSS, JavaScript and images, builds the render tree, lays it out, paints pixels and runs scripts. Each step can be skipped by caching or sped up.

Read the full answer

What is semantic HTML, and why does it matter?

Semantic HTML means choosing elements for what the content is, not how it looks: <button> for actions, <nav> for navigation, <h2> for a heading. Browsers, screen readers and search engines read those elements to understand the page. You get keyboard support, accessible names and a usable document outline without writing extra JavaScript or ARIA.

Read the full answer

What is the CSS box model?

The CSS box model says every element is a rectangular box made of four layers: content, padding, border and margin, from the inside out. The width and height you set apply to the content box by default, so padding and border make the element larger. Setting box-sizing: border-box makes width include padding and border instead.

Read the full answer

What is the DOM?

The DOM (Document Object Model) is the browser's in-memory tree of objects that represents an HTML page. JavaScript uses it to read, create, change and remove elements, attributes, text and styles, and to react to events. It is not the HTML source: the DOM is what the browser builds from the source, and it changes as scripts run.

Read the full answer

localStorage vs sessionStorage vs cookies

localStorage keeps string data in the browser until you delete it, sessionStorage keeps it only for one tab's session, and cookies are small values the browser sends to the server with matching requests. Use storage for client-only data, and cookies when the server needs the value, especially for sessions with the right flags.

Read the full answer

What is CORS, and how does it work?

CORS (Cross-Origin Resource Sharing) is a browser mechanism that lets a server say which other origins may read its responses. By default the same-origin policy stops a page on one origin from reading a response from another. The server opts in with headers like Access-Control-Allow-Origin, and the browser enforces the result. It is a relaxation of a rule, not a security feature that protects the server.

Read the full answer

What is the same-origin policy?

The same-origin policy is a browser security rule that stops a script on one origin from reading data from another origin. An origin is the combination of scheme, host and port. It keeps a malicious site from using your logged-in session to read your email or bank pages. Servers and tools like curl are not bound by it.

Read the full answer

script async vs defer: what is the difference?

Both async and defer make a classic script download in parallel with HTML parsing instead of blocking it. The difference is when the code runs. A defer script runs after the document is parsed, in the order it appears. An async script runs as soon as it finishes downloading, in any order, possibly mid-parse.

Read the full answer

HTTP/1.1 vs HTTP/2 vs HTTP/3: what changed?

HTTP/1.1 sends one request at a time per connection, so browsers open several. HTTP/2 sends many requests at once over a single TCP connection. HTTP/3 does the same over QUIC, which runs on UDP, so one lost packet no longer stalls every request. The meaning of HTTP stays the same: methods, headers and status codes do not change.

Read the full answer

What is the critical rendering path?

The critical rendering path is the sequence of steps the browser must complete before it can show the first pixels: build the DOM from HTML, build the CSSOM from CSS, combine them into a render tree, run layout, paint, and composite. Anything that blocks or lengthens those steps delays first paint, so optimising the path means shortening or unblocking them.

Read the full answer

Cache-Control: no-cache vs no-store vs max-age=0

no-cache lets caches store the response but requires them to check with the server before every reuse. no-store forbids storing it anywhere. max-age=0 makes it stale immediately, so caches normally revalidate too, but unlike no-cache it still allows stale reuse in some cases, such as when the server is unreachable. Use no-store for sensitive data and no-cache for content that must always be current.

Read the full answer

How do you make a website accessible?

To make a website accessible, start with semantic HTML, make every control work with the keyboard, label inputs and images, keep colour contrast high, manage focus when content changes, and respect user preferences like reduced motion. Then test with automated tools, the keyboard alone and a screen reader. Most of the work is not adding code but not breaking what HTML gives you.

Read the full answer

Easy64

Showing 64 of 125 easy questions. Browse the rest in the question bank

Medium60

Showing 60 of 64 medium questions. Browse the rest in the question bank

Practise with tests and full answers.

Every question has a runnable editor, tests and a step-by-step solution. Passes from ₹149, paid once; nothing renews.

Get full access
Rehearse it in a timed frontend mock interviewA real editor with tests, the follow-ups an interviewer asks, and a score out of 100.

Frequently asked

What are the most common web developer interview questions?

What happens when you type a URL into the browser, semantic HTML, the CSS box model and specificity, flexbox and grid, event bubbling and delegation, localStorage versus sessionStorage versus cookies, CORS and the same-origin policy, HTTP caching, and how to make a page load faster.

What do freshers get asked in a web developer interview?

HTML tags and forms, CSS selectors and layout, JavaScript basics such as var, let and const, functions and arrays, DOM manipulation and events, and simple questions about HTTP methods and status codes. Expect a small task such as building a form or a list in plain JavaScript.

Do web developer interviews include backend questions?

For full stack roles, yes: REST APIs, databases and authentication. For frontend-focused web roles, expect the browser side of the same topics: calling APIs with fetch, handling errors, storing tokens safely and understanding CORS.