A modern web application built with Next.js that helps you check your laptop's battery health by analyzing battery reports from Windows (PowerCfg) and Mac (system_profiler).
The Battery Health Checker is a user-friendly web application that calculates your laptop battery's health percentage by parsing Windows PowerCfg battery reports or Mac system_profiler battery reports. It provides an intuitive interface to upload your battery report and instantly see your battery's current health status.
- Simple Upload Interface: Easy-to-use file upload for battery reports
- Accurate Health Calculation: Calculates battery health percentage based on design capacity vs full charge capacity
- Modern UI: Clean, responsive design built with Tailwind CSS and shadcn/ui components
- Error Handling: Comprehensive error messages for invalid files or parsing issues
- Windows & Mac Integration: Works seamlessly with Windows PowerCfg battery reports and Mac system_profiler battery reports
- Node.js 18+ and npm
- Windows or Mac operating system (for generating battery reports)
- Clone the repository:
git clone https://github.com/Derojuu/BatteryHealthChecker.git
cd battery-health-checker- Install dependencies:
npm install- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
npm run build
npm startRun this command in Windows PowerShell or Command Prompt:
powercfg /batteryreport /output "C:\battery-report.html"Run this command in Terminal:
system_profiler SPPowerDataType > battery-report.txt- Open the Battery Health Checker web application
- Click "Choose File" and select the generated
battery-report.html(Windows) orbattery-report.txt(Mac) file - Click "Calculate Health" to get your battery health percentage
- View your battery health percentage and any relevant warnings
- 90-100%: Excellent battery health
- 80-89%: Good battery health
- 70-79%: Fair battery health
- Below 70%: Consider battery replacement
- Framework: Next.js 15.3.1 with App Router
- Language: TypeScript
- Styling: Tailwind CSS v4
- UI Components: Radix UI primitives with shadcn/ui
- Icons: Lucide React
- Font: Geist Sans & Geist Mono
battery-health-checker/
├── app/ # Next.js App Router directory
│ ├── page.tsx # Main battery checker component
│ ├── layout.tsx # Root layout with fonts and metadata
│ └── globals.css # Global styles and Tailwind imports
├── components/ui/ # Reusable UI components
│ ├── button.tsx # Custom button component
│ ├── card.tsx # Card layout components
│ ├── input.tsx # File input component
│ ├── label.tsx # Form label component
│ └── separator.tsx # Visual separator component
├── lib/
│ └── utils.ts # Utility functions (cn helper)
├── public/ # Static assets
└── package.json # Project dependencies and scripts
- File upload handling
- Battery report parsing logic
- Health percentage calculation
- Error handling and user feedback
- Modular, reusable components built with Radix UI
- Consistent styling with Tailwind CSS
- Accessible and responsive design
- File Upload: Users upload their PowerCfg battery report HTML file (Windows) or system_profiler text file (Mac)
- Text Parsing: The application extracts "DESIGN CAPACITY" and "FULL CHARGE CAPACITY" values (Windows) or "Design Capacity" and "Full Charge Capacity" (Mac)
- Health Calculation: Battery health = (Full Charge Capacity / Design Capacity) × 100
- Result Display: Shows the calculated percentage with appropriate styling
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
- "Capacity values not found": Ensure you're uploading a valid PowerCfg (Windows) or system_profiler (Mac) battery report
- "Failed to read or parse": Check that the file isn't corrupted and is in the correct format (HTML for Windows, TXT for Mac)
- No file selected: Make sure to select a file before clicking "Calculate Health"
If you encounter issues:
- Check that your battery report was generated correctly
- Ensure the file is the complete HTML report from PowerCfg
- Try regenerating the battery report and uploading again
- Built with Next.js
- UI components from shadcn/ui
- Styled with Tailwind CSS
- Icons by Lucide