The accept attribute tells an <input type="file"> which file types the user should pick. Its value is a comma-separated list of unique file type specifiers: extensions (e.g. .png), MIME types (e.g. image/jpeg), or wildcards (image/*, audio/*, video/*).
accept is an HTML attribute for file inputs in the browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
accept
Widely available since about July 2015. Desktop Chrome, Firefox, Safari, Edge, and Opera support filtering well. Some mobile browsers still report partial support.
96%Global support (approx.)
Google Chrome26+
Full support
Mozilla Firefox37+
Full support
Apple Safari11.1+
Full support
Microsoft Edge79+
Full support
Opera15+
Full support
Samsung InternetModern · Partial on some builds
Partial
Internet Explorer10+
Supported
acceptWidely supported
Bottom line: Safe to use as a UX filter everywhere. Treat missing or partial mobile filtering as another reason to validate uploads on the server.
Remember
Key Takeaways
Role: guide the file picker with extensions, MIME types, or image/* / audio/* / video/*.
Element: only <input type="file"> in modern HTML.
Combine freely: e.g. image/*,.pdf or a thorough Word list.
Security: always validate uploads on the server.
One line:accept filters the file dialog — it does not replace server-side checks.
Frequently Asked Questions
On an input with type=file, accept lists which file types the picker should allow. Values are comma-separated extensions (like .png), MIME types (like image/jpeg), or wildcards (image/*, audio/*, video/*).
Only input type=file in modern HTML. It was once allowed on form but that use was removed in favor of the file input.
No. It is only a hint for the file chooser. Users can often override the filter. Always check type, size, and content on the server.
.png filters by filename extension. image/* accepts any image MIME type (PNG, JPEG, WebP, and more). Many phones also offer the camera when image/* is used.
Yes. For example accept="image/*,.pdf" allows any image plus PDF files in one list.
It is Baseline widely available (since about July 2015). Desktop Chrome, Firefox, Safari, and Edge support it well. Some mobile browsers still treat filtering as partial.