This paper proposes a novel method called DiffUIR for universal image restoration based on diffusion models. The method introduces a selective hourglass mapping strategy that enables the model to learn shared information between different tasks while maintaining strong condition guidance. DiffUIR integrates a flexible shared distribution term (SDT) into the diffusion algorithm, which gradually maps different distributions into a shared one. This approach allows the model to iteratively guide the shared distribution to a task-specific distribution, achieving high-quality image restoration. The method is evaluated on five image restoration tasks and 22 benchmarks, demonstrating state-of-the-art performance in both the universal setting and zero-shot generalization setting. DiffUIR achieves outstanding performance with a lightweight model (only 0.89M parameters). The method is effective in handling various image restoration tasks, including deraining, low-light enhancement, desnowing, dehazing, and deblurring. The results show that DiffUIR outperforms existing universal methods in terms of performance and efficiency. The method is also validated through ablation studies and visual comparisons with state-of-the-art methods. The results demonstrate that DiffUIR is capable of handling different degradation types simultaneously and achieving high-quality image restoration. The method is also effective in real-world scenarios, where it achieves excellent performance in both known and unknown task generalization settings. The proposed method provides a new approach for universal image restoration based on diffusion models, enabling the model to learn shared information between different tasks while maintaining strong condition guidance.This paper proposes a novel method called DiffUIR for universal image restoration based on diffusion models. The method introduces a selective hourglass mapping strategy that enables the model to learn shared information between different tasks while maintaining strong condition guidance. DiffUIR integrates a flexible shared distribution term (SDT) into the diffusion algorithm, which gradually maps different distributions into a shared one. This approach allows the model to iteratively guide the shared distribution to a task-specific distribution, achieving high-quality image restoration. The method is evaluated on five image restoration tasks and 22 benchmarks, demonstrating state-of-the-art performance in both the universal setting and zero-shot generalization setting. DiffUIR achieves outstanding performance with a lightweight model (only 0.89M parameters). The method is effective in handling various image restoration tasks, including deraining, low-light enhancement, desnowing, dehazing, and deblurring. The results show that DiffUIR outperforms existing universal methods in terms of performance and efficiency. The method is also validated through ablation studies and visual comparisons with state-of-the-art methods. The results demonstrate that DiffUIR is capable of handling different degradation types simultaneously and achieving high-quality image restoration. The method is also effective in real-world scenarios, where it achieves excellent performance in both known and unknown task generalization settings. The proposed method provides a new approach for universal image restoration based on diffusion models, enabling the model to learn shared information between different tasks while maintaining strong condition guidance.