YOLO → COCO converter
Paste YOLO TXT annotations + class names, set the image dimensions, and get a clean COCO JSON. Pure JavaScript — your data never leaves the browser.
Need to convert thousands of files in a CI pipeline? See the dataset-export API.
About this conversion
YOLO and COCO are the two dominant detection annotation formats. They store the same information differently:
YOLO — one TXT file per image, one line per annotation. Each line is class_id center_x center_y width height, all normalised to 0-1 relative to the image.
COCO — one JSON file for the whole dataset. Bounding boxes are in pixel coordinates as [x_top_left, y_top_left, width, height]. Class names live in a categories array with 1-based IDs.
The conversion needs image dimensions because YOLO uses normalised coordinates and COCO uses pixels. Set width and height once for the whole batch (if all images are the same size) or run the API equivalent below if your images have varying sizes.
The same thing via the API (varying image sizes, batch)
This browser tool assumes uniform image dimensions. For a real dataset with varying sizes, the project export endpoint handles per-image dimensions, splits, and a dataset.yaml.
# Convert a whole project from YOLO labels to COCO JSON.
# Sync GET — the response body is the COCO ZIP.
import os, requests
resp = requests.get(
"https://api.msightflow.ai/v1/projects/PROJECT_ID/export",
headers={"Authorization": f"Bearer {os.environ['MSF_API_KEY']}"},
params={"format": "coco", "split": "80/20/0"},
stream=True,
)
with open("dataset_coco.zip", "wb") as f:
for chunk in resp.iter_content(1 << 20):
f.write(chunk)Free tier: 50 exports / month. Start free →
Sibling tools
Doing this on real datasets?
300 free API calls / month plus 50 exports. Full COCO/YOLO/VOC conversion with auto dataset.yaml + train/val/test split + webhook.