v0.2.1 Now Available

Content Types Lite

A lightweight, zero-dependency utility for MIME type lookups. Get file extensions from MIME types and vice versa with ease.

Zero Dependencies
TypeScript Ready
50+ MIME Types

Everything you need for MIME type handling

Simple, fast, and reliable MIME type lookups for your projects

Lightning Fast

Zero dependencies and optimized for performance with instant lookups.

Lightweight

Tiny bundle size that won't bloat your application.

Comprehensive

Support for 50+ common MIME types across all categories.

Type Safe

Full TypeScript support with proper type definitions.

Bidirectional

Lookup MIME types from extensions and vice versa.

Easy to Use

Simple, intuitive API that just works.

Interactive Demo

Try it yourself

Lookup MIME types and extensions in real-time

MIME Type Lookup
Enter a file extension (e.g., .pdf) or MIME type (e.g., application/pdf) to lookup
Try:

Documentation

Get started in minutes with our simple API

Installation

bash
npm install content-types-lite
# or
pnpm add content-types-lite
# or
yarn add content-types-lite

Get MIME Type from Extension

typescript
import { getMimeType } from 'content-types-lite';

const mimeType = getMimeType('.pdf');
console.log(mimeType); // 'application/pdf'

const pngType = getMimeType('image.png');
console.log(pngType); // 'image/png'

Get Extension from MIME Type

typescript
import { getExtension } from 'content-types-lite';

const ext = getExtension('application/json');
console.log(ext); // '.json'

const htmlExt = getExtension('text/html');
console.log(htmlExt); // '.html'

Get All Extensions

typescript
import { getTypeExtensions } from 'content-types-lite';

const extensions = getTypeExtensions('image/jpeg');
console.log(extensions); // ['.jpg', '.jpeg']

const pngExts = getTypeExtensions('image/png');
console.log(pngExts); // ['.png']

Browse MIME Types

Explore all supported MIME types and their extensions

Category:
image/jpeg
Image
JPEG image format
.jpg.jpeg
image/png
Image
Portable Network Graphics
.png
image/gif
Image
Graphics Interchange Format
.gif
image/webp
Image
WebP image format
.webp
image/svg+xml
Image
Scalable Vector Graphics
.svg
image/bmp
Image
Bitmap image format
.bmp
image/tiff
Image
Tagged Image File Format
.tif.tiff
image/x-icon
Image
Icon image format
.ico
audio/mpeg
Audio
MP3 audio format
.mp3
audio/wav
Audio
Waveform Audio File Format
.wav
audio/ogg
Audio
Ogg Vorbis audio
.ogg
audio/webm
Audio
WebM audio format
.weba
audio/aac
Audio
Advanced Audio Coding
.aac
audio/flac
Audio
Free Lossless Audio Codec
.flac
audio/midi
Audio
Musical Instrument Digital Interface
.mid.midi
video/mp4
Video
MPEG-4 video format
.mp4
video/webm
Video
WebM video format
.webm
video/ogg
Video
Ogg video format
.ogv
video/quicktime
Video
QuickTime video format
.mov
video/x-msvideo
Video
Audio Video Interleave
.avi
video/x-matroska
Video
Matroska video format
.mkv
text/plain
Text
Plain text file
.txt
text/html
Text
HyperText Markup Language
.html.htm
text/css
Text
Cascading Style Sheets
.css
text/javascript
Text
JavaScript source code
.js.mjs
text/typescript
Text
TypeScript source code
.ts.tsx
text/csv
Text
Comma-separated values
.csv
text/xml
Text
Extensible Markup Language
.xml
text/markdown
Text
Markdown document
.md.markdown
text/calendar
Text
iCalendar format
.ics
application/json
Application
JavaScript Object Notation
.json
application/xml
Application
XML document
.xml
application/pdf
Application
Portable Document Format
.pdf
application/zip
Application
ZIP archive
.zip
application/x-tar
Application
Tape Archive
.tar
application/gzip
Application
Gzip compressed archive
.gz.gzip
application/x-rar-compressed
Application
RAR archive
.rar
application/x-7z-compressed
Application
7-Zip archive
.7z
application/msword
Application
Microsoft Word document
.doc
application/vnd.openxmlformats-officedocument.wordprocessingml.document
Application
Microsoft Word (OpenXML) document
.docx
application/vnd.ms-excel
Application
Microsoft Excel spreadsheet
.xls
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Application
Microsoft Excel (OpenXML) spreadsheet
.xlsx
application/vnd.ms-powerpoint
Application
Microsoft PowerPoint presentation
.ppt
application/vnd.openxmlformats-officedocument.presentationml.presentation
Application
Microsoft PowerPoint (OpenXML) presentation
.pptx
application/x-shockwave-flash
Application
Adobe Flash
.swf
application/x-font-ttf
Application
TrueType Font
.ttf
application/font-woff
Application
Web Open Font Format
.woff
application/font-woff2
Application
Web Open Font Format 2
.woff2
application/octet-stream
Application
Binary data
.bin.exe.dll
application/x-www-form-urlencoded
Application
Form data encoding
No extensions
application/graphql
Application
GraphQL query language
.graphql
application/ld+json
Application
JSON-LD linked data
.jsonld
application/x-yaml
Application
YAML Ain't Markup Language
.yaml.yml
application/toml
Application
Tom's Obvious, Minimal Language
.toml
font/woff
Font
Web Open Font Format
.woff
font/woff2
Font
Web Open Font Format 2
.woff2
font/ttf
Font
TrueType Font
.ttf
font/otf
Font
OpenType Font
.otf
font/eot
Font
Embedded OpenType
.eot
Showing 59 of 59 MIME types

Ready to get started?

Install content-types-lite today and simplify your MIME type handling

Star on GitHub